-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
122 lines (111 loc) · 2.9 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
javascripts: ['frontend/javascripts/**/*.js'],
server_js: ['backend/**/*.js'],
views: ['frontend/views/**/*.jade'],
stylesheets: ['frontend/styles/**/*.styl'],
jshint: {
client: ['Gruntfile.js', '<%= javascripts %>', '!frontend/javascripts/libs/**/*.js'],
server: ['<%= server_js %>'],
options: {
sub: true,
smarttabs: true,
}
},
watch: {
options:{
livereload: true
},
scripts: {
files: ['<%= javascripts %>'],
tasks: ['javascripts']
},
server_js: {
files: ['<%= server_js %>'],
tasks: ['jshint:server'],
options:{
livereload: false
}
},
styles: {
files: ['<%= stylesheets %>'],
tasks: ['stylus']
},
jade: {
files: ['<%= views %>'],
tasks: ['jade']
}
},
jade: {
compile: {
options: {
debug: true
},
files: {
'public/_index.html': 'frontend/views/index.jade',
'public/404.html': 'frontend/views/404.jade',
'public/signin.html': 'frontend/views/signin.jade'
}
}
},
stylus: {
compile: {
options: {
'include css': true,
'paths': ['frontend/styles/'],
'compress': true
},
files: {
'public/styles/style.css': ['<%= stylesheets %>']
}
}
},
open : {
dev : {
path: 'http://localhost:3055/'
}
},
copy: {
libs: {files: [{expand: false, src: ['bower_components/requirejs/require.js'], dest: 'public/javascripts/libs/require.js'}]},
js: {files: [{expand: true, cwd: 'frontend/javascripts/', src: ['**'], dest: 'public/javascripts/'}]},
resources: {files: [{expand: true, cwd: 'frontend/resources/', src: ['**'], dest: 'public/resources/'}]},
images: {files: [{expand: true, cwd: 'frontend/images/', src: ['**'], dest: 'public/images/'}]}
},
clean: {
public_js: { src: ['public/javascripts']}
},
requirejs: {
options: {
baseUrl: '.',
appDir: 'frontend/javascripts',
mainConfigFile: 'frontend/javascripts/main.js',
optimize: 'uglify2',
generateSourceMaps: false,
preserveLicenseComments: false,
useStrict: true,
removeCombined: false,
modules: [{
name: 'main'
}]
},
main : {
options: {
dir: 'public/javascripts'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-open');
grunt.registerTask('common', ['jshint', 'jade', 'stylus', 'clean', 'copy']);
grunt.registerTask('javascripts', ['jshint', 'clean', 'copy']);
grunt.registerTask('default', ['common', 'open']);
grunt.registerTask('release', ['common', 'requirejs']);
};