-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.coffee
94 lines (78 loc) · 2.49 KB
/
config.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
sysPath = require 'path'
fs = require('fs')
_ = require 'lodash'
commonjsHeader = fs.readFileSync('node_modules/brunch/node_modules/commonjs-require-definition/require.js', {encoding: 'utf8'})
regJoin = (s) -> new RegExp(s.replace(/\//g, '[\\\/\\\\]'))
exports.config =
paths:
'public': 'public'
'watched': ['app', 'test/app', 'vendor', 'src']
conventions:
ignored: (path) -> _.startsWith(sysPath.basename(path), '_')
vendor: /(vendor|src|bower_components)[\\/]/
sourceMaps: true
files:
javascripts:
defaultExtension: 'coffee'
joinTo:
'javascripts/frimfram.js': /^src/
'../dist/frimfram.js': /^src/
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^(vendor|bower_components)(?![\/\\]underscore[\/\\])/
'javascripts/test-app.js': /^test[\/\\]app/
'javascripts/demo-app.js': /^test[\/\\]demo/
order:
before: [
'src/init.coffee'
'src/BaseClass.coffee'
'src/View.coffee'
'bower_components/jquery/dist/jquery.js'
'bower_components/lodash/lodash.js'
'bower_components/backbone/backbone.js'
'bower_components/bootstrap/dist/js/bootstrap.js'
'bower_components/tv4/tv4.js'
]
stylesheets:
defaultExtension: 'sass'
joinTo:
'../dist/frimfram.css': /^src/
'stylesheets/app.css': /^(app|vendor|bower_components|src)/
order:
before: [
'app/styles/bootstrap/*'
]
templates:
defaultExtension: 'jade'
joinTo: 'javascripts/app.js'
framework: 'backbone'
server:
command: 'node_modules/.bin/nodemon . -e "coffee,js" --watch server --watch app/schemas'
plugins:
coffeelint:
pattern: /^app\/.*\.coffee$/
options:
line_endings:
value: 'unix'
level: 'ignore'
max_line_length:
level: 'ignore'
no_unnecessary_fat_arrows:
level: 'ignore'
uglify:
output:
semicolons: false
sass:
mode: 'ruby'
allowCache: true
modules:
definition: (path) ->
if _(path).endsWith('app.js') then commonjsHeader else ''
onCompile: (files) ->
# TODO: update to the new setting
exec = require('child_process').exec
regexFrom = '\\/\\/# sourceMappingURL=([^\\/].*)\\.map'
regexTo = '\\/\\/# sourceMappingURL=\\/javascripts\\/$1\\.map'
regex = "s/#{regexFrom}/#{regexTo}/g"
for file in files
c = "perl -pi -e '#{regex}' #{file.path}"
exec c