-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
136 lines (132 loc) · 2.83 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
module.exports = function(grunt) {
// Project configuration
grunt.initConfig({
connect: {
options: {
port:9000,
hostname:'localhost',
livereload:35732
}
},
pkg: grunt.file.readJSON('package.json'),
// Concatenate all the JavaScript files
concat: {
files: {
src: ['public/js/**/*.js' ],
dest: 'public/concat/allAppCode.concat.js'
}
},
// Minify the concatenated files
uglify: {
options: {
report: 'min',
mangle: false
},
files: {
src: 'public/concat/allAppCode.concat.js',
dest: 'public/src/allAppCode.min.js'
}
},
// Check for syntax errors in all the JavaScript files
jshint: {
all: ['public/**/*.js', '!public/bower_components/**'],
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
laxbreak: true,
laxcomma: true,
globals: {
jQuery: true,
angular: true
}
}
},
// Compile scss files into css
sass: {
dist: {
options: {
sourceMap: true,
style: 'compressed'
},
files: {
'public/css/style.css': 'public/css/sass/style.scss'
}
}
},
// Compile pug files into html
pug: {
compile: {
options: {
data: {
debug: true
},
pretty: true,
},
files: [
{
expand: true,
cwd: 'public/views/pug',
src: ['**/*.pug'],
dest: 'public/views/',
rename: function(dest,src) {
var genFile = dest+src.replace('pug','html');
console.log('created: ',genFile);
return genFile;
},
},
],
},
},
/* Connect to localhost:3000
connect: {
server: {
options: {
open: true,
base: '.',
livereload: true
}
},
misc: {
options: {
open: true,
livereload: true
}
}
},*/
// Watch for changes made in the files below and run the assigned task
watch: {
options: {
livereload: 35732,
},
js: {
files: ['public/**/*.js','!public/bower_components/**'], // Files to watch
tasks: ['jshint'], // Tasks to run when watched files change
event: 'all'
},
pug: {
files: ['public/views/**/*.pug'],
tasks: ['pug'],
event: 'all'
},
css: {
files: ['public/stylesheets/**/*.scss'],
tasks: ['sass'],
event: 'all'
},
sass: {
files: ['public/css/sass/**/*.{scss,sass}'],
tasks: ['sass:dist'],
event: 'all'
},
},
});
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('default', ['jshint', 'sass:dist', 'pug','watch']);
grunt.registerTask('run-jshint', ['jshint']);
grunt.registerTask('run-sass',['sass']);
grunt.registerTask('run-pug',['pug']);
grunt.registerTask('makeMinFile',['jshint','concat','uglify']);
};