-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
63 lines (57 loc) · 2.04 KB
/
Gruntfile.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
module.exports = gruntFunction = (grunt) ->
gruntConfig =
urequire:
_all:
dependencies:
paths: bower: true
imports: lodash: ['_']
clean: true
UMD:
path: "source/code"
resources: [
'inject-version'
[ '+single-quotes', ['**/*.js'],
(m)-> m.codegenOptions = format: quotes: 'single'] # change escodegen options
]
dependencies: node: ['nodeOnly/*']
dstPath: "build/UMD"
template:
name: 'UMDplain'
banner: true
min:
derive: 'UMD'
dstPath: "build/minified/urequire-example-min.js"
template: name: 'combined'
optimize: uglify2:
output: beautify: true
compress: false
mangle: false
rjs: preserveLicenseComments: false
spec:
path: "source/spec"
dstPath: "build/spec"
dependencies: imports:
chai: 'chai'
uberscore: '_B'
'urequire-example': ['uEx']
'specHelpers': 'spH'
resources: [
['import-keys',
'specHelpers': [ 'tru', ['equal', 'eq'], 'fals', 'ok' ]
'chai': 'expect' ] ]
afterBuild: require('urequire-ab-specrunner').options
injectCode: 'window.urequireExample = "Old global `urequireExample`";'
specDev:
derive: 'spec'
dstPath: "build/spec_combined/index-combined.js"
template: name: 'combined'
specWatch: derive: 'specDev', watch: true
splitTasks = (tasks)-> if (tasks instanceof Array) then tasks else tasks.split(/\s/).filter((f)->!!f)
grunt.registerTask shortCut, "urequire:#{shortCut}" for shortCut of gruntConfig.urequire
grunt.registerTask shortCut, splitTasks tasks for shortCut, tasks of {
default: "UMD spec min specDev"
develop: "min specWatch"
all: "UMD spec UMD specDev min spec min specDev"
}
grunt.loadNpmTasks task for task of grunt.file.readJSON('package.json').devDependencies when task.lastIndexOf('grunt-', 0) is 0
grunt.initConfig gruntConfig