-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
87 lines (82 loc) · 2 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
var path = require("path");
var wpconfig = require("./webpack.config.js");
module.exports = function(grunt) {
grunt.initConfig({
// Check over syntax for JSX files
eslint: {
js6:{
src: ["src/**"]
}
},
// Check over syntax for JS files
jshint: {
js5: {
files: {
src: ['Gruntfile.js', 'webpack.config.js', 'test/**/*.js']
},
options: {}
},
js6: {
files: {
src: ['src/**']
},
options: {
jshintrc: '.jshintrc',
ignores: [],
additionalSuffixes: ['.js']
}
}
},
// Compile stylus files to CSS
stylus: {
compile: {
files: [{
expand: true,
cwd: 'static/lib/stylus',
src: ['*.styl', '**/*.styl'],
dest: 'build/client/css',
ext: '.css'
}]
}
},
// Watch for changes on files
watch: {
// For stylus, compile them on change
stylus: {
files: ['static/lib/stylus/**'],
tasks: ['stylus:compile']
},
// For js5, check their syntax
js5:{
files: ['<%= jshint.js5.files.src %>'],
tasks: ['jshint:js5']
},
// FOr js6, check their syntax
js6:{
files: ['<%= jshint.js6.files.src %>'],
tasks: ['jshint:js6']
}
},
// Sets up the Webpack Development Server
"webpack-dev-server":{
start: {
contentBase: wpconfig.devServer.contentBase,
webpack: {
entry: wpconfig.entry,
output: wpconfig.output,
module: wpconfig.module
},
keepalive: true
}
}
});
// Load npm tasks
grunt.loadNpmTasks('grunt-jsxhint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-webpack');
// Register tasks
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['stylus']);
grunt.registerTask('devserver', ["webpack-dev-server"]);
};