-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
93 lines (80 loc) · 1.61 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
module.exports = function ( grunt ) {
const sass = require('sass');
// require it at the top and pass in the grunt instance
require( 'time-grunt' )( grunt );
// Load all Grunt tasks
require( 'jit-grunt' )( grunt, {} );
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
// Newer files checker
newer: {
options: {
override: function ( detail, include ) {
if ( detail.task === 'php' || detail.task === 'sass' ) {
include( true );
} else {
include( false );
}
}
}
},
// Watch for changes.
watch: {
options: {
livereload: true,
spawn: false
},
},
// Copy the theme into the build directory
copy: {
build: {
expand: true,
src: [
'**',
'!node_modules/**',
'!build/**',
'!vendor/**',
'!.git/**',
'!changelog.txt',
'!composer.json',
'!composer-lock.json',
'!Gruntfile.js',
'!package.json',
'!package-lock.json',
'!phpcs.xml.dist',
'!.tern-project',
'!.gitignore',
'!.jshintrc',
'!.DS_Store',
'!*.map',
'!**/*.map',
'!**/Gruntfile.js',
'!**/package.json',
'!**/*~'
],
dest: 'build/<%= pkg.name %>/'
}
},
// Compress build directory into <name>.zip
compress: {
build: {
options: {
mode: 'zip',
archive: './build/<%= pkg.name %>.zip'
},
expand: true,
cwd: 'build/<%= pkg.name %>/',
src: [ '**/*' ],
dest: '<%= pkg.name %>/'
}
},
} );
// Production task
grunt.registerTask( 'build', [
'copy'
] );
// Package task
grunt.registerTask( 'package', [
'compress',
] );
};