-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathGruntfile.js
108 lines (95 loc) · 2.32 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
module.exports = function(grunt) {
grunt.initConfig({
// Make package info available to tasks
pkg: grunt.file.readJSON('package.json'),
// Browserify front-end modules
browserify: {
options: {
browserifyOptions: {
debug: true
}
},
js: {
src: ['src/browser/js/app.js'],
dest: 'public/app.js'
}
},
uglify: {
dist: {
files: {
'public/app.min.js': 'public/app.js'
}
}
},
// Compile Sass stylesheets
sass: {
dev: {
options: {
sourceMap: true
},
files: {
'public/app.css': 'src/browser/scss/app.scss'
}
},
dist: {
options: {
sourceMap: false,
outputStyle: 'compressed'
},
files: {
'public/app.min.css': 'src/browser/scss/app.scss'
}
}
},
watch: {
javascript: {
files: ['src/browser/js/**/*.js'],
tasks: ['browserify']
},
sass: {
files: 'src/browser/scss/**/*.scss',
tasks: ['sass:dev']
}
},
// restart server node process during development
nodemon: {
dev: {
script: 'bin/server.js',
options: {
ignore: ['node_modules/**', 'public', 'src/browser']
}
}
},
// Shell commands to run via Grunt
shell: {
// Execute mocha tests
test: {
command: 'npm test'
}
},
// Run dev watch tasks (and others potentially) concurrently
concurrent: {
dev: {
tasks: ['watch', 'nodemon'],
options: {
logConcurrentOutput: true
}
}
}
});
// Load third party tasks
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default is running the local development server
grunt.registerTask('default', ['sass:dev', 'browserify', 'concurrent:dev']);
// Build production assets
grunt.registerTask('collect_static',
['init_static', 'sass:dist', 'browserify', 'uglify']);
// Custom tasks
grunt.loadTasks('bin/tasks');
};