-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
104 lines (97 loc) · 2.79 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
module.exports = function(grunt) {
grunt.initConfig({
postcss: {
options: {
map: false,
processors: [
require('precss')(), // allow you to use Sass-like CSS.
// require('pixrem')(), // add fallbacks for rem units.
// require('postcss-calc')(), // reduces calc() to values (when expressions involve the same units).
require('autoprefixer-core')({browsers: 'last 2 versions'}), // add vendor prefixes
]
},
dist: {
files: {
'css/css.css': 'src/style.css'
}
}
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
// 'css/css.min.css': ['css/css.css', 'css/scss.css']
'css/css.min.css': 'css/css.css'
// 'css/css': 'css/css.css'
// this way when someone downloads this site it won't work correctly
}
}
},
watch: {
css: {
files: ['src/*.css'],
tasks: ['postcss']
},
},
htmlmin: { // Task
dist: { // Target
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'index.html': 'index-source.html' // 'destination': 'source'
}
}
},
uglify: {
options: {
compress: {
drop_console: true
}
},
my_target: {
files: {
'js/js.min.js': [
'js/js/text-scramble.js',
'js/js/form-submission-handler.js',
'js/js/menuspy.min.js',
'js/js/menu-spy.js',
'js/js/smooth-scroll.js',
// 'js/js/github-calendar.min.js',
'js/js/modal.js',
'js/js/blazy.min.js',
'js/js/be-lazy.js'
// 'js/js/baseline.js',
]
}
}
},
// cacheBust: {
// options: {
// assets: ['dist/assets/**/*'],
// baseDir: './dist/'
// },
// taskName: {
// files: [{
// expand: true,
// cwd: 'dist/',
// src: ['index.html', 'assets/**/*']
// }]
// }
// }
});
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
// grunt.loadNpmTasks('grunt-cache-bust');
// Default tasks.
grunt.registerTask('default', ['htmlmin'], ['postcss'], ['cssmin']);
};
// https://github.com/PaulTondeur/grunt-cache-busting