-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
81 lines (77 loc) · 2.3 KB
/
Gruntfile.js
File metadata and controls
81 lines (77 loc) · 2.3 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
expand: true,
cwd: 'src/js/',
src: ['*.js'],
dest: 'js/',
ext: '.min.js'
}
},
bake: {
build: {
files: {
"index.html": "src/index.html",
"accessibility.html": "src/accessibility.html",
"blackjack.html": "src/blackjack.html",
"design-system.html": "src/design-system.html",
"dreamstate.html": "src/dreamstate.html",
"form-api.html": "src/form-api.html",
"media-optimization.html": "src/media-optimization.html",
"mega-menu-navigation.html": "src/mega-menu-navigation.html",
"plant-parenthood.html": "src/plant-parenthood.html",
"search-api.html": "src/search-api.html",
"skincare.html": "src/skincare.html"
}
}
},
cssmin: {
options: {
// Optional: Add a banner to the minified CSS
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
minify: {
expand: true,
cwd: 'src/css/custom/', // Source directory for your CSS files
src: ['*.css', '!*.min.css'], // Match all .css files except already minified ones
dest: 'css/', // Destination directory for minified CSS
ext: '.min.css' // Add .min.css extension to minified files
}
},
watch: {
scripts: {
files: ['src/js/*.js'],
tasks: ['uglify'],
options: {
spawn: false,
},
},
css: {
files: ['src/css/custom/*.css'],
tasks: ['cssmin'],
options: {
spawn: false,
},
},
html: {
files: ['src/**/*.html', 'includes/**/*.html'],
tasks: ['bake'],
options: {
spawn: false,
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-bake');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default to compile theme updates
grunt.registerTask('default', ['bake', 'cssmin', 'uglify']);
};