-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgruntfile.js
More file actions
87 lines (80 loc) · 1.92 KB
/
gruntfile.js
File metadata and controls
87 lines (80 loc) · 1.92 KB
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
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-cssbeautifier');
grunt.loadNpmTasks('grunt-strip-css-comments');
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
// Define paths.
paths: {
sass: 'source/sass',
devCSS: 'css',
prodCSS: 'source/deploy/styles',
}, // paths
uglify: {
global: {
files: {
"js/site.min.js": ['source/js/*.js']
}
}
}, // uglify
cssbeautifier: {
global: {
files: {
src: ['css/*.css']
},
options: {
indent: ' ',
openbrace: 'end-of-line',
autosemicolon: false
}
}
}, // cssbeautifier
stripCssComments: {
global: {
files: [{
expand: true,
src: ['css/*.css']
}]
}
}, // stripCssComments
sass: {
global: {
options: {
sourceMap: true,
sourceComments: false,
outputStyle: 'expanded'
},
// I suspect this method slows down grunt
// @todo - test with named files.
files: [{
expand: true,
cwd: '<%= paths.sass %>/',
src: ['**/*.scss'],
dest: '<%= paths.devCSS %>/',
ext: '.css'
},
],
}
}, // sass
watch: {
options: {
livereload: true
},
site: {
files: ['templates/**/*.tpl.php', 'js/**/*.{js,json}', 'css/*.css', 'images/**/*.{png,jpg,jpeg,gif,webp,svg}']
},
js: {
files: ['source/js/*.js'],
tasks: ["uglify"]
},
css: {
files: ["source/sass/**/*.scss"],
tasks: ["sass"]
},
} // watch
});
require("load-grunt-tasks")(grunt);
// grunt command
grunt.registerTask("default", ["sass", "watch"]);
// grunt format command (run before code commit)
grunt.registerTask("format", ["stripCssComments", "cssbeautifier"]);
};