This repository has been archived by the owner on Aug 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
120 lines (113 loc) · 4.8 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
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
watch: {
"server": {
options: {
livereload: true
},
files: ["sass/**/*.scss", "js/**/*.js", '**/*.html'],
tasks: ["watch"]
},
"all": {
options: {
livereload: true
},
files: ["sass/**.scss", "js/**.js"],
tasks: ["default"]
}
},
compass: {
dev: {
options: {
sassDir: 'sass',
cssDir: 'css',
environment: 'development',
outputStyle: 'expanded' // expanded, nested, compact, compressed
}
}
},
autoprefixer: {
dist: {
files: {
'css/main.css': 'css/main.css'
}
}
},
cssmin: {
dist: {
options: {
keepSpecialComments: 0
},
files: {
'css/main.min.css': 'css/main.css'
}
}
},
jshint: {
dev: ['gruntfile.js', 'js/**/*.js'],
options: {
ignores: ['js/vendor/**/*.js']
}
},
concat: {
dist: {
src: ['js/**/*.js'],
dest: 'js/min/scripts.min.js'
}
},
uglify: {
dist: {
options: {
mangle: false
},
files: {
'js/min/scripts.min.js': ['js/min/scripts.min.js']
}
}
},
clean: {
cleanbuild: ['js/min/scripts.min.js', 'css/main.css', 'css/main.min.css']
},
imagemin: {
dist: {
options: {
optimizationLevel: 5 // 0-7
},
files: [{
expand: true,
cwd: 'img/',
src: ['**/*.png', '**/*.jpg'],
dest: 'img/'
}]
}
}
});
/*=====================================
= Loading Tasks =
=====================================*/
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-imagemin');
/*=============================================
= Build Systems =
=============================================*/
// Used for the final build
// *Compiles SASS for files in css/sass in to single minfied MAIN.CSS file. I recommend including any other .SCSS files in the MAIN.SCSS file.
// *Runs JSHint on all JS files, excluding files in the "vendor" directory.
// *Concatinates all JS files.
// *Uglifies concatinated js file (scripts.temp.js) and outputs scripts.min.js.
// *Compressed JPG and PNG images.
grunt.registerTask('default', ["clean:cleanbuild", "compass:dev", "autoprefixer:dist", "cssmin:dist", "jshint:dev", "concat:dist", "uglify:dist", "imagemin:dist"]);
grunt.registerTask('default', ["clean:cleanbuild", "compass:dev", "autoprefixer:dist", "cssmin:dist", "jshint:dev", "concat:dist", "uglify:dist"]);
// Used for the dev build
// *Compiles SASS for files in css/sass in to single expanded MAIN.CSS file. I recommend including any other .SCSS files in the MAIN.SCSS file.
// *Runs JSHint on all JS files, excluding files in the "vendor" directory.
grunt.registerTask('dev', ["clean:cleanbuild", "compass:dev", "autoprefixer:dist", "jshint:dev"]);
};