-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
101 lines (96 loc) · 3.23 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
/*global module:false*/
module.exports = function(grunt) {
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
theme_npm_install: {
command: 'npm install',
options: {
execOptions: {
cwd: '<%= pkg.themesPath %>/<%= pkg.domain %>/'
}
}
},
plugin_npm_install: {
command: 'npm install',
options: {
execOptions: {
cwd: '<%= pkg.pluginPath %>/<%= pkg.apiPlugin %>/'
}
}
},
theme_bower_install: {
command: 'bower install',
options: {
execOptions: {
cwd: '<%= pkg.themesPath %>/<%= pkg.domain %>/'
}
}
},
wordpress_download: {
command: 'wp core download --force'
}
},
// Setup filesystem
// environment specific configs will override all default configs
// see documentation: https://github.com/viastudio/grunt-via-filesystem
via_filesystem: {
default: {
symLinks: [
],
dirs: [
{
path: 'wp-content/uploads',
permissions: '0777'
},
]
},
dev: {
symLinks: [
{
src: '/var/www/<%= pkg.name %>/wp-content/uploads',
dest: 'wp-content/uploads'
},
{
src: 'wp-via-config.php',
dest: 'wp-config.php'
},
{
src: '',
dest: 'webroot'
}
]
},
stage: {
symLinks: [
{
src: 'robots.stage.txt',
dest: 'robots.txt'
}
]
},
prod: {
symLinks: [
{
src: 'robots.prod.txt',
dest: 'robots.txt'
}
]
}
},
hub: {
// Build for stage/prod
build: {
src: ['<%= pkg.themesPath %>/*/Gruntfile.js'],
src: ['<%= pkg.pluginPath %>/<%= pkg.apiPlugin %>/Gruntfile.js']
}
}
});
// Load plugins. Run npm install to install these according to package.json
grunt.loadNpmTasks('grunt-hub');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-via-filesystem');
grunt.registerTask('default', ['shell:theme_npm_install', 'shell:theme_bower_install', 'hub:build']); // Default task - executes when you run grunt
grunt.registerTask('setup', ['shell:wordpress_download', 'shell:theme_npm_install', 'shell:theme_bower_install', 'via_filesystem', 'shell:plugin_npm_install', 'hub:build']);
};