-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
127 lines (106 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
125
126
127
module.exports = function (grunt) {
'use strict';
// ====================
// == Edit this section
var jsFileList = [
'public/js/socket.io.js',
'public/js/underscore-min.js',
'public/js/script.js'
];
var distDir = 'public/js/dist/';
var jsFile = 'script.min.js';
// ====================
// ====================
// Project configuration.
grunt.initConfig({
pkg: require('./package'),
jshint: {
all: jsFileList,
options: {
jshintrc: '.jshintrc'
}
},
// Choose Sass files below
sass: {
dev: {
options: {
unixNewlines: true,
style: 'expanded',
lineNumbers: false,
debugInfo : false,
precision : 8,
sourcemap : true
},
files: {
'public/css/kickoff.css': 'public/scss/kickoff.scss'
}
},
deploy: {
options: {
style: 'compressed'
},
files: {
'public/css/kickoff.min.css': 'public/scss/kickoff.scss'
}
}
},
uglify: {
options: {
// mangle: Turn on or off mangling
mangle: true,
// beautify: beautify your code for debugging/troubleshooting purposes
beautify: false,
// report: Show file size report
report: 'gzip',
// sourceMap: @string. The location of the source map, relative to the project
sourceMap: distDir + jsFile + '.map',
// sourceMappingURL: @string. The string that is printed to the final file
sourceMappingURL: jsFile +'.map',
// sourceMapRoot: @string. The location where your source files can be found. This sets the sourceRoot field in the source map.
sourceMapRoot: '../../'
// sourceMapPrefix: @integer. The number of directories to drop from the path prefix when declaring files in the source map.
// sourceMapPrefix: 1,
},
js: {
src: jsFileList,
dest: distDir + jsFile
}
},
watch: {
scss: {
files: ['public/scss/**/*.scss'],
tasks: 'sass:dev'
},
js: {
files: [
'Gruntfile.js',
'public/js/**/*.js',
'public/js/libs/**/*.js'
],
tasks: ['uglify']
},
livereload: {
options: { livereload: true },
files: [
'public/css/*.css'
]
}
}
});
// Load some stuff
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-devtools');
// =============
// === Tasks ===
// =============
// A task for development
grunt.registerTask('dev', ['uglify', 'sass:dev']);
// A task for deployment
grunt.registerTask('deploy', ['uglify', 'sass:deploy']);
// Default task
grunt.registerTask('default', ['uglify', 'sass:dev']);
};