This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
64 lines (57 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
module.exports = function (grunt) {
// Grunt project configuration.
grunt.initConfig({
sass: { // options for the sass compiler
options: {
style: 'compressed', // minify the code
sourcemap: 'none' // don't create source maps
},
dist: {
src: 'sass/base.scss', // input sass file
dest: 'build/css/styles-compiled.css' // output css file
}
},
cssnext: { // options for cssnext function
dist: {
src: 'build/css/styles-compiled.css', // input css file
dest: 'build/css/styles.css' // output css file
}
},
concat: { // options for the concat function
js: {
src: ['js/**/*.js'], // input - any file / folder in the js folder
dest: 'build/js/scripts.js' // output js file
}
},
jshint: { // options for the jshint function
options: {
// strict: true // switch this line on for more strict linting
},
beforeconcat: ['Gruntfile.js', 'js/**/*.js'], // input files before concatenation
afterconcat: ['build/js/scripts.js'] // input files after concatenation
},
uglify: { // options for the uglify function
dist: {
src: 'build/js/scripts.js', // the input js file
dest: 'build/js/scripts.min.js' // the output, minified js file
}
},
watch: { // options for the watch function
js: { // a 'sub-function' I called js that only watches my js folder
files: ['js/**/*.js'], // 'watch' this folder
tasks: ['concat:js', 'jshint', 'uglify'] // if there are changes, run these tasks
},
css: { // a 'sub-function' I called css that only watches my csss folder
files: ['sass/**/*.scss'], // 'watch' this folder
tasks: ['sass', 'cssnext'] // if there are changes, run these tasks
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-cssnext');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['sass', 'cssnext', 'concat', 'jshint', 'uglify', 'watch']); // setup the default Grunt tasks that are run when we run only 'grunt' in the terminal
};