-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
86 lines (78 loc) · 2.69 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
'use strict';
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
grunt.initConfig({
sass: {
dist: {
options: { // Target options
noCache: true,
},
files: {
'wp-content/themes/krunch/css/style.css': 'wp-content/themes/krunch/css/style.scss'
},
sourcemap: true
}
},
imagemin: { // Task
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'wp-content/themes/krunch/img/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'wp-content/themes/krunch/img/' // Destination path prefix
}]
}
},
cssmin: {
target: {
files: {
'wp-content/themes/krunch/css/style.min.css': ['wp-content/themes/krunch/css/style.css']
}
}
},
uglify: {
my_target: {
files: {
'wp-content/themes/krunch/js/krunch.min.js': ['wp-content/themes/krunch/js/krunch.js']
}
}
},
watch: {
css: {
files: ['wp-content/themes/krunch/css/*.scss','wp-content/themes/krunch/css/includes/*.scss'],
tasks: ['sass', 'cssmin'],
options: {
// Start a live reload server on the default port 35729
livereload: 8080,
},
},
scripts: {
files: ['wp-content/themes/krunch/js/*.js'],
options: {
// Start a live reload server on the default port 35729
livereload: 8080,
},
},
html: {
files: ['wp-content/themes/krunch/*.php','wp-content/themes/krunch/blocks/*.php'],
tasks: ['sass', 'cssmin', 'uglify'],
options: {
// Start a live reload server on the default port 35729
livereload: 8080,
},
}
}
});
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['imagemin', 'cssmin', 'uglify']);
};