From ac0713dfca9cb17fc52e0f5acf44a8f6456a70b9 Mon Sep 17 00:00:00 2001 From: Lilumi Odi Date: Sat, 28 Sep 2019 16:27:30 +0300 Subject: [PATCH 1/4] Add "custom-editor-style.scss" and any other sass file to watch and compile process. Add all js files to the 'scripts' gulp task. --- gulpfile.js | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 191cab1..4f718b4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -26,12 +26,12 @@ var paths = cfg.paths; // Run: // gulp sass // Compiles SCSS files in CSS -gulp.task('sass', function() { +gulp.task('sass', function () { var stream = gulp .src(paths.sass + '/*.scss') .pipe( plumber({ - errorHandler: function(err) { + errorHandler: function (err) { console.log(err); this.emit('end'); } @@ -48,8 +48,8 @@ gulp.task('sass', function() { // Run: // gulp watch // Starts watcher. Watcher runs gulp sass task on changes -gulp.task('watch', function() { - gulp.watch(`${paths.sass}/**/*.scss`, gulp.series('styles')); +gulp.task('watch', function () { + gulp.watch([`${paths.sass}/**/*.scss`, `${paths.sass}/*.scss`], gulp.series('styles')); gulp.watch( [ `${paths.dev}/js/**/*.js`, @@ -67,7 +67,7 @@ gulp.task('watch', function() { // Run: // gulp imagemin // Running image optimizing task -gulp.task('imagemin', function() { +gulp.task('imagemin', function () { gulp .src(`${paths.imgsrc}/**`) .pipe(imagemin()) @@ -80,7 +80,7 @@ gulp.task('imagemin', function() { */ gulp.task( 'imagemin-watch', - gulp.series('imagemin', function() { + gulp.series('imagemin', function () { browserSync.reload(); }) ); @@ -88,13 +88,13 @@ gulp.task( // Run: // gulp cssnano // Minifies CSS files -gulp.task('cssnano', function() { +gulp.task('cssnano', function () { return gulp .src(paths.css + '/theme.css') .pipe(sourcemaps.init({ loadMaps: true })) .pipe( plumber({ - errorHandler: function(err) { + errorHandler: function (err) { console.log(err); this.emit('end'); } @@ -106,14 +106,14 @@ gulp.task('cssnano', function() { .pipe(gulp.dest(paths.css)); }); -gulp.task('minifycss', function() { +gulp.task('minifycss', function () { return gulp .src(`${paths.css}/theme.css`) .pipe(sourcemaps.init({ loadMaps: true })) .pipe(cleanCSS({ compatibility: '*' })) .pipe( plumber({ - errorHandler: function(err) { + errorHandler: function (err) { console.log(err); this.emit('end'); } @@ -124,31 +124,32 @@ gulp.task('minifycss', function() { .pipe(gulp.dest(paths.css)); }); -gulp.task('cleancss', function() { +gulp.task('cleancss', function () { return gulp .src(`${paths.css}/*.min.css`, { read: false }) // Much faster .pipe(ignore('theme.css')) .pipe(rimraf()); }); -gulp.task('styles', function(callback) { +gulp.task('styles', function (callback) { gulp.series('sass', 'minifycss')(callback); }); // Run: // gulp browser-sync // Starts browser-sync task for starting the server. -gulp.task('browser-sync', function() { +gulp.task('browser-sync', function () { browserSync.init(cfg.browserSyncWatchFiles, cfg.browserSyncOptions); }); // Run: // gulp scripts. // Uglifies and concat all JS files into one -gulp.task('scripts', function() { +gulp.task('scripts', function () { var scripts = [ // Start - All BS4 stuff `${paths.dev}/js/bootstrap4/bootstrap.bundle.js`, + `${paths.dev}/js/themejs/*.js`, // End - All BS4 stuff @@ -162,7 +163,7 @@ gulp.task('scripts', function() { .src(scripts, { allowEmpty: true }) .pipe(babel( { - presets: ['@babel/preset-env'] + presets: ['@babel/preset-env'] } )) .pipe(concat('theme.min.js')) @@ -177,7 +178,7 @@ gulp.task('scripts', function() { }); // Deleting any file inside the /src folder -gulp.task('clean-source', function() { +gulp.task('clean-source', function () { return del(['src/**/*']); }); @@ -191,7 +192,7 @@ gulp.task('watch-bs', gulp.parallel('browser-sync', 'watch')); // Copy all needed dependency assets files from bower_component assets to themes /js, /scss and /fonts folder. Run this task after bower install or bower update ////////////////// All Bootstrap SASS Assets ///////////////////////// -gulp.task('copy-assets', function(done) { +gulp.task('copy-assets', function (done) { ////////////////// All Bootstrap 4 Assets ///////////////////////// // Copy all JS files var stream = gulp @@ -229,7 +230,7 @@ gulp.task('copy-assets', function(done) { }); // Deleting the files distributed by the copy-assets task -gulp.task('clean-vendor-assets', function() { +gulp.task('clean-vendor-assets', function () { return del([ `${paths.dev}/js/bootstrap4/**`, `${paths.dev}/sass/bootstrap4/**`, @@ -245,7 +246,7 @@ gulp.task('clean-vendor-assets', function() { }); // Deleting any file inside the /dist folder -gulp.task('clean-dist', function() { +gulp.task('clean-dist', function () { return del([paths.dist + '/**']); }); @@ -254,7 +255,7 @@ gulp.task('clean-dist', function() { // Copies the files to the /dist folder for distribution as simple theme gulp.task( 'dist', - gulp.series(['clean-dist'], function() { + gulp.series(['clean-dist'], function () { return gulp .src( [ @@ -309,7 +310,7 @@ gulp.task( ); // Deleting any file inside the /dist-product folder -gulp.task('clean-dist-product', function() { +gulp.task('clean-dist-product', function () { return del([paths.distprod + '/**']); }); @@ -318,7 +319,7 @@ gulp.task('clean-dist-product', function() { // Copies the files to the /dist-prod folder for distribution as theme with all assets gulp.task( 'dist-product', - gulp.series(['clean-dist-product'], function() { + gulp.series(['clean-dist-product'], function () { return gulp .src([ '**/*', @@ -344,4 +345,4 @@ gulp.task('compile', gulp.series('styles', 'scripts', 'dist')); // Run: // gulp // Starts watcher (default task) -gulp.task('default', gulp.series('watch')); +gulp.task('default', gulp.series('watch')); \ No newline at end of file From 16144fd330a321fc9009bc1a89358d0485874bd7 Mon Sep 17 00:00:00 2001 From: Lilumi Odi Date: Sat, 28 Sep 2019 16:30:03 +0300 Subject: [PATCH 2/4] add "custom-editor-style" to minify process --- gulpfile.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4f718b4..085ff89 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -107,10 +107,18 @@ gulp.task('cssnano', function () { }); gulp.task('minifycss', function () { + return gulp - .src(`${paths.css}/theme.css`) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(cleanCSS({ compatibility: '*' })) + .src([ + `${paths.css}/custom-editor-style.css`, + `${paths.css}/theme.css`, + ]) + .pipe(sourcemaps.init({ + loadMaps: true + })) + .pipe(cleanCSS({ + compatibility: '*' + })) .pipe( plumber({ errorHandler: function (err) { From a31199a7a10df5d9f8b1027cedaf9e5445f1ee7b Mon Sep 17 00:00:00 2001 From: lilumi Date: Sun, 29 Sep 2019 13:16:42 +0300 Subject: [PATCH 3/4] make correct modification date for generated css files --- gulpfile.js | 16 +++++++++++----- package.json | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 085ff89..e3f4e98 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,6 +5,7 @@ var sass = require('gulp-sass'); var babel = require('gulp-babel'); var postcss = require('gulp-postcss'); var watch = require('gulp-watch'); +var touch = require('gulp-touch-fd'); var rename = require('gulp-rename'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); @@ -41,7 +42,8 @@ gulp.task('sass', function () { .pipe(sass({ errLogToConsole: true })) .pipe(postcss([autoprefixer()])) .pipe(sourcemaps.write(undefined, { sourceRoot: null })) - .pipe(gulp.dest(paths.css)); + .pipe(gulp.dest(paths.css)) + .pipe(touch()); return stream; }); @@ -103,7 +105,8 @@ gulp.task('cssnano', function () { .pipe(rename({ suffix: '.min' })) .pipe(cssnano({ discardComments: { removeAll: true } })) .pipe(sourcemaps.write('./')) - .pipe(gulp.dest(paths.css)); + .pipe(gulp.dest(paths.css)) + .pipe(touch()); }); gulp.task('minifycss', function () { @@ -129,7 +132,8 @@ gulp.task('minifycss', function () { ) .pipe(rename({ suffix: '.min' })) .pipe(sourcemaps.write('./')) - .pipe(gulp.dest(paths.css)); + .pipe(gulp.dest(paths.css)) + .pipe(touch()); }); gulp.task('cleancss', function () { @@ -313,7 +317,8 @@ gulp.task( { skipBinary: true } ) ) - .pipe(gulp.dest(paths.dist)); + .pipe(gulp.dest(paths.dist)) + .pipe(touch()); }) ); @@ -341,7 +346,8 @@ gulp.task( `!${paths.distprod}/**`, '*' ]) - .pipe(gulp.dest(paths.distprod)); + .pipe(gulp.dest(paths.distprod)) + .pipe(touch()); }) ); diff --git a/package.json b/package.json index 23e4322..2048abe 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dependencies": { "@babel/preset-env": "^7.4.5", "bootstrap": "^4.3.1", - "browser-sync": "^2.26.3", + "browser-sync": "^2.26.7", "del": "^4.1.0", "font-awesome": "^4.7.0", "gulp": "^4.0.0", @@ -45,6 +45,7 @@ "gulp-sass": "^4.0.2", "gulp-sequence": "^1.0.0", "gulp-sourcemaps": "^2.6.5", + "gulp-touch-fd": "^2.0.0", "gulp-uglify": "^3.0.2", "gulp-watch": "^5.0.1", "run-sequence": "^2.2.1", From 7a02eed85c7503ed17c45b441779ca9b4e76c034 Mon Sep 17 00:00:00 2001 From: lilumi Date: Mon, 30 Sep 2019 00:08:49 +0300 Subject: [PATCH 4/4] fix travis config --- .travis.yml | 6 +++--- README.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a385117..dd3dafe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,11 +47,11 @@ before_script: - sed -i "s/yourusernamehere/root/" wp-tests-config.php - sed -i "s/yourpasswordhere//" wp-tests-config.php # Create WordPress database. - - mysql -e 'CREATE DATABASE wordpress_test;' -uroot + #- mysql -u root -e "CREATE DATABASE wordpress_test;" # Install CodeSniffer for WordPress Coding Standards checks. - - mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/2.7.0.tar.gz | tar xz --strip-components=1 -C php-codesniffer + - mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/3.5.0.tar.gz | tar xz --strip-components=1 -C php-codesniffer # Install WordPress Coding Standards. - - mkdir wordpress-coding-standards && curl -L https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/0.10.0.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards + - mkdir wordpress-coding-standards && curl -L https://github.com/WordPress/WordPress-Coding-Standards/archive/2.1.1.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards # Hop into CodeSniffer directory. - cd php-codesniffer # Set install path for WordPress Coding Standards diff --git a/README.md b/README.md index 43fd391..dcf0ae5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Travis build: [![Build Status](https://travis-ci.org/understrap/understrap.svg?branch=master)](https://travis-ci.org/understrap/understrap) +Travis build: [![Build Status](https://api.travis-ci.org/lilumi/understrap.svg?branch=lm-improve)](https://travis-ci.org/lilumi/understrap) #### See: [Official Demo](https://understrap.com/understrap) | Read: [Official Docs Page](https://understrap.github.io/)