-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
124 lines (117 loc) · 2.66 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
/**
* Gruntfile
*
* @author Andreas Klein
* @date 2013-05-26
*/
module.exports = function (grunt) {
'use strict';
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
globals: {
DEV_SERVER_PORT: 3322
},
banner: '/*! <%= pkg.name %> - v<%= pkg.version %>- ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */',
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
}
},
src: ['*.js', 'www/scripts/*.js']
},
jscs: {
src: '<%= jshint.src %>',
options: {
config: '.jscsrc'
}
},
less: {
main: {
options: {
compress: false,
report: false,
dumpLineNumbers: 'comments',
banner: '<%= banner %>'
},
files: {
'www/styles/core.css': 'www/styles/less/core.less'
}
}
},
autoprefixer: {
options: {
browsers: ['last 1 version'],
report: 'min'
},
css: {
src: ['www/styles/**/*.css']
}
},
watch: {
less: {
files: ['www/styles/**/*.less'],
tasks: ['less', 'autoprefixer']
},
js: {
files: ['*.js', 'www/scripts/*.js'],
tasks: ['jshint', 'jscs']
}
},
open: {
server: {
path: 'http://localhost:<%= globals.DEV_SERVER_PORT %>'
}
},
cssmin: {
options: {
report: 'min'
},
dist: {
expand: true,
cwd: 'www/styles/',
src: ['**/*.css'],
dest: 'www/styles/'
}
}
});
/**
* Register Tasks:
*
* (1) 'prod': Build for Prod enviroment
* (2) 'assets' : Lint & build static assets like (SASS Files)
* (3) 'dev' Development Workflow
* (4) default (run `dev` task)
*/
grunt.registerTask('prod', [
'jshint',
'jscs',
'less',
'autoprefixer',
'cssmin'
]);
grunt.registerTask('assets', [
'jshint',
'jscs',
'autoprefixer'
]);
grunt.registerTask('node-server', function () {
grunt.util.spawn({
cmd: 'node',
args: ['index.js']
});
});
grunt.registerTask('dev', function () {
grunt.task.run('node-server');
grunt.task.run('assets');
grunt.task.run('open');
grunt.task.run('watch');
});
grunt.registerTask('default', ['dev']);
};