-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
101 lines (95 loc) · 3.33 KB
/
Gruntfile.js
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
95
96
97
98
99
100
101
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean : {
js : ['lib'],
css : ['css']
},
coffee : {
join : {
options: {
join: true,
bare : true
},
files: {
'lib/<%= pkg.name %>.js': [
'src/preamble.coffee',
'src/models/model.coffee',
'src/models/collection.coffee',
'src/views/view.coffee',
'src/views/tree.coffee',
'src/views/item.coffee',
'src/views/list.coffee',
'src/views/placeholder.coffee',
'src/models/settings.coffee',
'src/plugins/basic.coffee',
'src/plugins/dnd.coffee'
]
}
}
},
concat: {
options: {
banner: '(function (root, factory) {\n\n' +
' if (typeof define === "function" && define.amd) {\n' +
' // AMD (+ global for extensions)\n' +
' define(["underscore", "backbone", "backbone-tree-model"], function (_, Backbone) {\n' +
' return (root.BackTree = factory(_, Backbone));\n' +
' });\n' +
' } else if (typeof exports === "object") {\n' +
' // CommonJS\n' +
' module.exports = factory(require("underscore"), require("backbone"), require("backbone-tree-model"));\n' +
' } else {\n' +
' // Browser\n' +
' root.BackTree = factory(root._, root.Backbone);\n' +
' }' +
'}(this, function (_, Backbone) {\n\n "use strict";\n\n',
footer: ' return BackTree;\n' +
'}));',
stripBanners: true
},
dist: {
src: ['lib/<%= pkg.name %>.js'],
dest: 'lib/<%= pkg.name %>.js'
}
},
uglify : {
dist : {
src: '<%= concat.dist.dest %>',
dest: 'lib/<%= pkg.name %>.min.js'
}
},
watch : {
js : {
files : 'src/**/*.coffee',
tasks : ['js']
},
css : {
files : 'less/**/*.less',
tasks : ['css']
}
},
less : {
bootstrap : {
options : {
paths: ['node_modules/bootstrap/less']
},
files : {
'css/bootstrap-theme.css' : 'less/bootstrap-theme.less'
}
}
},
cssmin : {
options : {},
target: {
files: {
'css/bootstrap-theme.min.css': ['css/bootstrap-theme.css']
}
}
}
});
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'})
grunt.registerTask('js', ['clean:js', 'coffee', 'concat', 'uglify']);
grunt.registerTask('css', ['clean:css', 'less', 'cssmin']);
grunt.registerTask('default', ['js', 'css']);
};