Skip to content

Commit d38fa77

Browse files
committed
Update grunt config
1 parent 817f5e4 commit d38fa77

File tree

4 files changed

+114
-24
lines changed

4 files changed

+114
-24
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.idea
55
composer.lock
66
material-design.zip
7+
material-design-google.zip
78
yarn.lock
89
plugin/assets/css/*
910
!plugin/assets/css/src/

Gruntfile.js

+92-24
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,23 @@ module.exports = function( grunt ) {
2323
grunt.initConfig( {
2424
// Build a deploy-able plugin.
2525
copy: {
26-
build: {
26+
plugin: {
2727
src: [
28-
'**',
29-
'!.*',
30-
'!.*/**',
31-
'!**/._.DS_Store',
32-
'!**/.DS_Store',
33-
'!assets/css/src/**',
34-
'!assets/js/.gitignore',
35-
'!assets/src/**',
36-
'!assets/images/png/**',
37-
'!assets/images/jpg/**',
28+
'plugin/**',
29+
'!plugin/.*',
30+
'!plugin/.*/**',
31+
'!plugin/**/._.DS_Store',
32+
'!plugin/**/.DS_Store',
33+
'!plugin/assets/css/src/**',
34+
'!plugin/assets/js/.gitignore',
35+
'!plugin/assets/src/**',
36+
'!plugin/assets/images/png/**',
37+
'!plugin/assets/images/jpg/**',
38+
'!plugin/tests/**',
39+
'!plugin/composer*',
40+
'!plugin/readme.md',
41+
'!plugin/vendor/**',
42+
'!plugin/phpunit.xml',
3843
'!bin/**',
3944
'!build/**',
4045
'!built/**',
@@ -56,9 +61,60 @@ module.exports = function( grunt ) {
5661
'!postcss.config.js',
5762
'!readme.md',
5863
'!renovate.json',
59-
'!tests/**',
6064
'!vendor/**',
6165
'!webpack.config.js',
66+
'!webpack/**',
67+
],
68+
dest: 'build',
69+
expand: true,
70+
dot: true,
71+
},
72+
theme: {
73+
src: [
74+
'theme/**',
75+
'!theme/.*',
76+
'!theme/.*/**',
77+
'!theme/**/._.DS_Store',
78+
'!theme/**/.DS_Store',
79+
'!theme/assets/css/src/**',
80+
'!theme/assets/css/*.map',
81+
'!theme/assets/js/.gitignore',
82+
'!theme/assets/js/*.php',
83+
'!theme/assets/js/*.map',
84+
'!theme/assets/src/**',
85+
'!theme/tests/**',
86+
'!theme/wp-assets/**',
87+
'!theme/composer*',
88+
'!theme/readme.md',
89+
'!theme/vendor/**',
90+
'!theme/phpunit.xml',
91+
'!bin/**',
92+
'!build/**',
93+
'!built/**',
94+
'!code_of_conduct.md',
95+
'!CONTRIBUTING.md',
96+
'!contributing/**',
97+
'!composer.json',
98+
'!composer.lock',
99+
'!contributing.md',
100+
'!docker-compose.yml',
101+
'!docker-compose-plugin-dev.yml',
102+
'!material-design-google.zip',
103+
'!Gruntfile.js',
104+
'!jest.config.js',
105+
'!node_modules/**',
106+
'!npm-debug.log',
107+
'!package.json',
108+
'!package-lock.json',
109+
'!phpcs.xml',
110+
'!phpcs.xml.dist',
111+
'!phpunit.xml',
112+
'!postcss.config.js',
113+
'!README.md',
114+
'!renovate.json',
115+
'!vendor/**',
116+
'!webpack.config.js',
117+
'!webpack/**',
62118
],
63119
dest: 'build',
64120
expand: true,
@@ -70,12 +126,18 @@ module.exports = function( grunt ) {
70126
clean: {
71127
compiled: {
72128
src: [
73-
'assets/js/*.js',
74-
'assets/js/*.js.map',
75-
'assets/js/*.asset.php',
76-
'assets/css/*.css',
77-
'!assets/css/src/*',
78-
'assets/css/*.css.map',
129+
'plugin/assets/js/*.js',
130+
'plugin/assets/js/*.js.map',
131+
'plugin/assets/js/*.asset.php',
132+
'plugin/assets/css/*.css',
133+
'!plugin/assets/css/src/*',
134+
'plugin/assets/css/*.css.map',
135+
'theme/assets/js/*.js',
136+
'theme/assets/js/*.js.map',
137+
'theme/assets/js/*.asset.php',
138+
'theme/assets/css/*.css',
139+
'!theme/assets/css/src/*',
140+
'theme/assets/css/*.css.map',
79141
],
80142
},
81143
build: {
@@ -92,8 +154,11 @@ module.exports = function( grunt ) {
92154
readme: {
93155
command: './vendor/xwp/wp-dev-lib/scripts/generate-markdown-readme', // Generate the readme.md.
94156
},
95-
create_build_zip: {
96-
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design.zip ]; then rm material-design.zip; fi; mv build material-design; zip -r ./material-design.zip material-design; mv material-design build; echo; echo "ZIP of build: $(pwd)/material-design.zip"',
157+
create_plugin_zip: {
158+
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design.zip ]; then rm material-design.zip; fi; mv build/plugin ./material-design; zip -r ./material-design.zip ./material-design; mv ./material-design build/plugin; echo; echo "ZIP of build: $(pwd)/material-design.zip"',
159+
},
160+
create_theme_zip: {
161+
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design-google.zip ]; then rm material-design-google.zip; fi; mv build/theme ./material-design-google; zip -r ./material-design-google.zip ./material-design-google; mv ./material-design-google build/theme; echo; echo "ZIP of build: $(pwd)/material-design-google.zip"',
97162
},
98163
},
99164

@@ -102,7 +167,7 @@ module.exports = function( grunt ) {
102167
deploy: {
103168
options: {
104169
plugin_slug: 'material-design',
105-
build_dir: 'build',
170+
build_dir: 'build/plugin',
106171
assets_dir: 'wp-assets',
107172
},
108173
},
@@ -117,8 +182,8 @@ module.exports = function( grunt ) {
117182

118183
// Register custom tasks.
119184
grunt.registerTask( 'icon_mapping', 'Turn codepoints into JSON', () => {
120-
const filePath = 'assets/fonts/icons.json';
121-
const iconFile = grunt.file.read( 'assets/fonts/icons.codepoints' );
185+
const filePath = 'plugin/assets/fonts/icons.json';
186+
const iconFile = grunt.file.read( 'plugin/assets/fonts/icons.codepoints' );
122187
const iconItems = iconFile.split( /\r?\n/g );
123188
const icons = {
124189
icons: {},
@@ -145,7 +210,10 @@ module.exports = function( grunt ) {
145210

146211
grunt.registerTask( 'build', [ 'readme', 'copy', 'icon_mapping' ] );
147212

148-
grunt.registerTask( 'create-build-zip', [ 'shell:create_build_zip' ] );
213+
grunt.registerTask( 'create-build-zip', [
214+
'shell:create_plugin_zip',
215+
'shell:create_theme_zip',
216+
] );
149217

150218
grunt.registerTask( 'deploy', [ 'build', 'wp_deploy', 'clean' ] );
151219
};

readme.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- DO NOT EDIT THIS FILE; it is auto-generated from readme.txt -->
2+
# Material Design for WordPress
3+
4+
The official Material Design plugin for WordPress. Customize your site’s navigation, colors, typography, and shapes, use Material Components, and choose from over 1,000 Google Fonts and Material Design icons. From the team behind Google’s open-source design system.
5+
6+
**Contributors:** [google](https://profiles.wordpress.org/google), [materialdesign](https://profiles.wordpress.org/materialdesign), [xwp](https://profiles.wordpress.org/xwp)
7+
8+
[![Build Status](https://travis-ci.com/xwp/material-design-wp-plugin.svg?branch=develop)](https://travis-ci.com/xwp/material-design-wp-plugin) [![Coverage Status](https://coveralls.io/repos/xwp/material-design-wp-plugin/badge.svg?branch=develop)](https://coveralls.io/github/xwp/material-design-wp-plugin) [![Built with Grunt](https://gruntjs.com/cdn/builtwith.svg)](http://gruntjs.com)
9+
10+
## Description ##
11+
12+
The official Material Design plugin for WordPress. Customize your site’s navigation, colors, typography, and shapes, use Material Components, and choose from over 1,000 Google Fonts and Material Design icons. From the team behind Google’s open-source design system.
13+

readme.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== Material Design for WordPress ===
2+
Contributors: google, materialdesign, xwp
3+
4+
The official Material Design plugin for WordPress. Customize your site’s navigation, colors, typography, and shapes, use Material Components, and choose from over 1,000 Google Fonts and Material Design icons. From the team behind Google’s open-source design system.
5+
6+
== Description ==
7+
8+
The official Material Design plugin for WordPress. Customize your site’s navigation, colors, typography, and shapes, use Material Components, and choose from over 1,000 Google Fonts and Material Design icons. From the team behind Google’s open-source design system.

0 commit comments

Comments
 (0)