-
Notifications
You must be signed in to change notification settings - Fork 3
/
gruntfile.js
157 lines (154 loc) · 3.87 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
},
clean: {
dist: ['dist'],
},
less: {
dist: {
options: {
banner: '/*! /!\\ GENERATED \n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
files: {
'dist/css/main.css': 'app/style/main.less'
}
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer')()
]
},
dist: {
src: 'dist/css/main.css'
}
},
copy: {
dist: {
files: [{
expand: true,
cwd: 'app/',
src: ['**', '!style'],
dest: 'dist/'
}, {
expand: true,
cwd: 'node_modules/milligram/dist/',
src: ['**'],
dest: 'dist/css/'
}, {
expand: true,
cwd: 'node_modules/normalize.css/',
src: ['*.css'],
dest: 'dist/css/'
}, {
expand: true,
cwd: 'node_modules/jquery/dist/',
src: ['jquery.min.*'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/jquery-resizable-dom/dist/',
src: ['jquery-resizable.min.*'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/codemirror/lib/',
src: ['*.js'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/codemirror/addon/mode/',
src: ['simple.js'],
dest: 'dist/js/codemirror-mode/'
}, {
expand: true,
cwd: 'node_modules/codemirror/lib/',
src: ['*.css'],
dest: 'dist/css/'
}, {
expand: true,
cwd: 'node_modules/json-formatter-js/dist/',
src: ['*'],
dest: 'dist/js/'
}, {
src: ['lessons.js'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/d3/',
src: ['d3.min.js*'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/c3/',
src: ['c3.min.js*'],
dest: 'dist/js/'
}, {
expand: true,
cwd: 'node_modules/c3/',
src: ['c3.min.css*'],
dest: 'dist/css/'
}, {
expand: true,
cwd: 'node_modules/moment/',
src: ['moment.js'],
dest: 'dist/js/'
}, {
src: ['lessons.js'],
dest: 'dist/js/'
}]
}
},
execute: {
lessons: {
src: ['bundleLessons.js']
}
},
watch: {
dev: {
files: ['lessons/**/*', 'app/**/*'],
tasks: ['lessons', 'dist'],
options: {
atBegin: true,
},
},
lessons: {
files: ['lessons/**/*'],
tasks: ['lessons'],
options: {
atBegin: true,
},
}
},
'http-server': {
dev: {
root: 'dist',
port: 8080
}
},
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-http-server');
grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['clean:dist', 'lessons', 'dist']);
grunt.registerTask('dist', ['copy:dist', 'less:dist', 'postcss:dist']);
grunt.registerTask('lessons', ['execute:lessons']);
grunt.registerTask('dev', ['clean:dist', 'watch:dev']);
grunt.registerTask('serve', ['http-server']);
};