-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathGruntfile.js
80 lines (68 loc) · 1.65 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
var path = require('path');
process.env.PORT = process.env.PORT || 3000;
module.exports = function(grunt) {
grunt.initConfig({
clean: {
all: ['dist']
},
copy: {
all: {
files: [{
expand: true,
cwd: 'app',
src: '**',
dest: 'dist'
}]
}
},
less: {
client: {
src: 'app/client/index.less',
dest: 'dist/index.css'
}
},
coffee: {
all: {
expand: true,
cwd: 'app',
src: ['**/*.coffee'],
dest: 'dist',
// ext: '.js' doesn't work because of grunt crazyness: https://github.com/gruntjs/grunt/pull/625
rename: function(dest, name) { return dest + '/' + name.replace(/\.coffee$/gi, '.js'); }
}
},
browserify: {
client: {
src: 'dist/client-entry.js',
dest: 'dist/browserify.js'
}
},
watch: {
scripts: {
files: ['app/**/*.js', 'app/**/*.json', 'app/**/*.coffee'],
tasks: ['copy', 'coffee', 'browserify'],
options: {
spawn: false
}
},
styles: {
files: ['app/**/*.less', 'app/**/*.css'],
tasks: ['less', 'livereload']
},
assets: {
files: ['app/assets/**'],
tasks: ['copy', 'livereload']
}
},
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('compile', ['clean', 'copy', 'coffee', 'browserify', 'less']);
grunt.registerTask('server', ['livereload-start', 'watch']);
grunt.registerTask('default', ['compile', 'server']);
};