From 32b0d0d8996fddc0944126cc5de46cec171f0f8b Mon Sep 17 00:00:00 2001 From: Alison Monteiro Date: Wed, 7 Mar 2018 17:10:26 -0300 Subject: [PATCH 1/3] chore(wp): copy plugins with npm scripts --- package.json | 3 ++- plugins/.gitkeep | 0 tasks/wp-build.js | 9 --------- 3 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 plugins/.gitkeep diff --git a/package.json b/package.json index 7dc3019..4876657 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,10 @@ "serve": "gulp", "init": "gulp init --name", "start": "npm install && bower install && npm run init", - "wp": "gulp set-format --name \"wordpress\" && gulp wp-install && gulp wp-build", + "wp": "gulp set-format --name \"wordpress\" && gulp wp-install && gulp wp-build && npm run wp:plugins", "wp:dev": "npm run wp && gulp", "wp:build": "npm run wp && gulp build", + "wp:plugins": "cp -r ./plugins ./wordpress/wp-content", "front": "gulp set-format --name \"default\"", "front:dev": "npm run front && gulp", "front:build": "npm run front && gulp build" diff --git a/plugins/.gitkeep b/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tasks/wp-build.js b/tasks/wp-build.js index dfcd72e..551bcea 100644 --- a/tasks/wp-build.js +++ b/tasks/wp-build.js @@ -8,15 +8,6 @@ gulp.task('wp-build', function() { del([gulpPaths.themesWp + '*', '!' + gulpPaths.themesWp + packageJson.name, '!' + gulpPaths.themesWp + 'index.php']); - gulp.src([gulpPaths.pluginsWp]) - .pipe(plumber({ - errorHandler: error => { - console.log(error.message); - this.emit('end'); - } - })) - .pipe(gulp.dest('wordpress/wp-content/plugins/')); - gulp.src('src/style.css') .pipe(plumber({ errorHandler: error => { From b7504d2bc3ddf66d243ea2076e14b9ceccb684d7 Mon Sep 17 00:00:00 2001 From: Alison Monteiro Date: Wed, 7 Mar 2018 17:11:23 -0300 Subject: [PATCH 2/3] chore(styles): copy `style.css` after run `clean` task --- tasks/styles.js | 17 ++++++++++++++--- tasks/wp-build.js | 9 --------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tasks/styles.js b/tasks/styles.js index 843a97e..b376fdd 100755 --- a/tasks/styles.js +++ b/tasks/styles.js @@ -8,7 +8,9 @@ const sassLint = require('gulp-sass-lint'); const browserSync = require('browser-sync'); gulp.task('styles', function() { - return gulp.src(gulp.paths.styles) + const {paths} = gulp; + + gulp.src(paths.styles) .pipe(plumber({ errorHandler: error => { console.log(error.message); @@ -25,6 +27,15 @@ gulp.task('styles', function() { .pipe(sourcemaps.write('.', { mapFile: mapFilePath => mapFilePath.replace('.js.map', '.map') })) - .pipe(gulp.dest(gulp.paths.stylesDest)) - .pipe(browserSync.reload({stream: true})) + .pipe(gulp.dest(paths.stylesDest)) + .pipe(browserSync.reload({stream: true})); + + gulp.src('src/style.css') + .pipe(plumber({ + errorHandler: error => { + console.log(error.message); + this.emit('end'); + } + })) + .pipe(gulp.dest(paths.pagesDest)); }); diff --git a/tasks/wp-build.js b/tasks/wp-build.js index 551bcea..2dc7f2d 100644 --- a/tasks/wp-build.js +++ b/tasks/wp-build.js @@ -7,13 +7,4 @@ gulp.task('wp-build', function() { const packageJson = gulp.config.packageJson; del([gulpPaths.themesWp + '*', '!' + gulpPaths.themesWp + packageJson.name, '!' + gulpPaths.themesWp + 'index.php']); - - gulp.src('src/style.css') - .pipe(plumber({ - errorHandler: error => { - console.log(error.message); - this.emit('end'); - } - })) - .pipe(gulp.dest(gulpPaths.pagesDest)); }); From 8c7fc9fde7717c5e8867f35e2cdc468e9bad6531 Mon Sep 17 00:00:00 2001 From: Alison Monteiro Date: Wed, 7 Mar 2018 17:17:49 -0300 Subject: [PATCH 3/3] chore(wp): change task name from `wp-build` to `wp-pre-build` --- gulpfile.js | 2 +- package.json | 2 +- tasks/{wp-build.js => wp-pre-build.js} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename tasks/{wp-build.js => wp-pre-build.js} (88%) diff --git a/gulpfile.js b/gulpfile.js index 2630798..5cb60a4 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,7 +6,7 @@ const packageJson = require('./package.json'); let defaultTasks = ['build', 'watch', 'connect-sync']; if (packageJson.projectFormat === 'wordpress') { - defaultTasks.push('wp-build'); + defaultTasks.push('wp-pre-build'); } const baseConfig = { diff --git a/package.json b/package.json index 4876657..78d95ba 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "serve": "gulp", "init": "gulp init --name", "start": "npm install && bower install && npm run init", - "wp": "gulp set-format --name \"wordpress\" && gulp wp-install && gulp wp-build && npm run wp:plugins", + "wp": "gulp set-format --name \"wordpress\" && gulp wp-install && gulp wp-pre-build && npm run wp:plugins", "wp:dev": "npm run wp && gulp", "wp:build": "npm run wp && gulp build", "wp:plugins": "cp -r ./plugins ./wordpress/wp-content", diff --git a/tasks/wp-build.js b/tasks/wp-pre-build.js similarity index 88% rename from tasks/wp-build.js rename to tasks/wp-pre-build.js index 2dc7f2d..b79e91a 100644 --- a/tasks/wp-build.js +++ b/tasks/wp-pre-build.js @@ -2,7 +2,7 @@ const gulp = require('gulp'); const plumber = require('gulp-plumber'); const del = require('del'); -gulp.task('wp-build', function() { +gulp.task('wp-pre-build', function() { const gulpPaths = gulp.paths; const packageJson = gulp.config.packageJson;