Add "custom-editor-style.scss" and any other sass file to watch and compile process.

Add all js files to the 'scripts' gulp task.
This commit is contained in:
Lilumi Odi 2019-09-28 16:27:30 +03:00
parent c2a06502b7
commit ac0713dfca
1 changed files with 24 additions and 23 deletions

View File

@ -26,12 +26,12 @@ var paths = cfg.paths;
// Run: // Run:
// gulp sass // gulp sass
// Compiles SCSS files in CSS // Compiles SCSS files in CSS
gulp.task('sass', function() { gulp.task('sass', function () {
var stream = gulp var stream = gulp
.src(paths.sass + '/*.scss') .src(paths.sass + '/*.scss')
.pipe( .pipe(
plumber({ plumber({
errorHandler: function(err) { errorHandler: function (err) {
console.log(err); console.log(err);
this.emit('end'); this.emit('end');
} }
@ -48,8 +48,8 @@ gulp.task('sass', function() {
// Run: // Run:
// gulp watch // gulp watch
// Starts watcher. Watcher runs gulp sass task on changes // Starts watcher. Watcher runs gulp sass task on changes
gulp.task('watch', function() { gulp.task('watch', function () {
gulp.watch(`${paths.sass}/**/*.scss`, gulp.series('styles')); gulp.watch([`${paths.sass}/**/*.scss`, `${paths.sass}/*.scss`], gulp.series('styles'));
gulp.watch( gulp.watch(
[ [
`${paths.dev}/js/**/*.js`, `${paths.dev}/js/**/*.js`,
@ -67,7 +67,7 @@ gulp.task('watch', function() {
// Run: // Run:
// gulp imagemin // gulp imagemin
// Running image optimizing task // Running image optimizing task
gulp.task('imagemin', function() { gulp.task('imagemin', function () {
gulp gulp
.src(`${paths.imgsrc}/**`) .src(`${paths.imgsrc}/**`)
.pipe(imagemin()) .pipe(imagemin())
@ -80,7 +80,7 @@ gulp.task('imagemin', function() {
*/ */
gulp.task( gulp.task(
'imagemin-watch', 'imagemin-watch',
gulp.series('imagemin', function() { gulp.series('imagemin', function () {
browserSync.reload(); browserSync.reload();
}) })
); );
@ -88,13 +88,13 @@ gulp.task(
// Run: // Run:
// gulp cssnano // gulp cssnano
// Minifies CSS files // Minifies CSS files
gulp.task('cssnano', function() { gulp.task('cssnano', function () {
return gulp return gulp
.src(paths.css + '/theme.css') .src(paths.css + '/theme.css')
.pipe(sourcemaps.init({ loadMaps: true })) .pipe(sourcemaps.init({ loadMaps: true }))
.pipe( .pipe(
plumber({ plumber({
errorHandler: function(err) { errorHandler: function (err) {
console.log(err); console.log(err);
this.emit('end'); this.emit('end');
} }
@ -106,14 +106,14 @@ gulp.task('cssnano', function() {
.pipe(gulp.dest(paths.css)); .pipe(gulp.dest(paths.css));
}); });
gulp.task('minifycss', function() { gulp.task('minifycss', function () {
return gulp return gulp
.src(`${paths.css}/theme.css`) .src(`${paths.css}/theme.css`)
.pipe(sourcemaps.init({ loadMaps: true })) .pipe(sourcemaps.init({ loadMaps: true }))
.pipe(cleanCSS({ compatibility: '*' })) .pipe(cleanCSS({ compatibility: '*' }))
.pipe( .pipe(
plumber({ plumber({
errorHandler: function(err) { errorHandler: function (err) {
console.log(err); console.log(err);
this.emit('end'); this.emit('end');
} }
@ -124,31 +124,32 @@ gulp.task('minifycss', function() {
.pipe(gulp.dest(paths.css)); .pipe(gulp.dest(paths.css));
}); });
gulp.task('cleancss', function() { gulp.task('cleancss', function () {
return gulp return gulp
.src(`${paths.css}/*.min.css`, { read: false }) // Much faster .src(`${paths.css}/*.min.css`, { read: false }) // Much faster
.pipe(ignore('theme.css')) .pipe(ignore('theme.css'))
.pipe(rimraf()); .pipe(rimraf());
}); });
gulp.task('styles', function(callback) { gulp.task('styles', function (callback) {
gulp.series('sass', 'minifycss')(callback); gulp.series('sass', 'minifycss')(callback);
}); });
// Run: // Run:
// gulp browser-sync // gulp browser-sync
// Starts browser-sync task for starting the server. // Starts browser-sync task for starting the server.
gulp.task('browser-sync', function() { gulp.task('browser-sync', function () {
browserSync.init(cfg.browserSyncWatchFiles, cfg.browserSyncOptions); browserSync.init(cfg.browserSyncWatchFiles, cfg.browserSyncOptions);
}); });
// Run: // Run:
// gulp scripts. // gulp scripts.
// Uglifies and concat all JS files into one // Uglifies and concat all JS files into one
gulp.task('scripts', function() { gulp.task('scripts', function () {
var scripts = [ var scripts = [
// Start - All BS4 stuff // Start - All BS4 stuff
`${paths.dev}/js/bootstrap4/bootstrap.bundle.js`, `${paths.dev}/js/bootstrap4/bootstrap.bundle.js`,
`${paths.dev}/js/themejs/*.js`,
// End - All BS4 stuff // End - All BS4 stuff
@ -177,7 +178,7 @@ gulp.task('scripts', function() {
}); });
// Deleting any file inside the /src folder // Deleting any file inside the /src folder
gulp.task('clean-source', function() { gulp.task('clean-source', function () {
return del(['src/**/*']); 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 // 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 ///////////////////////// ////////////////// All Bootstrap SASS Assets /////////////////////////
gulp.task('copy-assets', function(done) { gulp.task('copy-assets', function (done) {
////////////////// All Bootstrap 4 Assets ///////////////////////// ////////////////// All Bootstrap 4 Assets /////////////////////////
// Copy all JS files // Copy all JS files
var stream = gulp var stream = gulp
@ -229,7 +230,7 @@ gulp.task('copy-assets', function(done) {
}); });
// Deleting the files distributed by the copy-assets task // Deleting the files distributed by the copy-assets task
gulp.task('clean-vendor-assets', function() { gulp.task('clean-vendor-assets', function () {
return del([ return del([
`${paths.dev}/js/bootstrap4/**`, `${paths.dev}/js/bootstrap4/**`,
`${paths.dev}/sass/bootstrap4/**`, `${paths.dev}/sass/bootstrap4/**`,
@ -245,7 +246,7 @@ gulp.task('clean-vendor-assets', function() {
}); });
// Deleting any file inside the /dist folder // Deleting any file inside the /dist folder
gulp.task('clean-dist', function() { gulp.task('clean-dist', function () {
return del([paths.dist + '/**']); 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 // Copies the files to the /dist folder for distribution as simple theme
gulp.task( gulp.task(
'dist', 'dist',
gulp.series(['clean-dist'], function() { gulp.series(['clean-dist'], function () {
return gulp return gulp
.src( .src(
[ [
@ -309,7 +310,7 @@ gulp.task(
); );
// Deleting any file inside the /dist-product folder // Deleting any file inside the /dist-product folder
gulp.task('clean-dist-product', function() { gulp.task('clean-dist-product', function () {
return del([paths.distprod + '/**']); 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 // Copies the files to the /dist-prod folder for distribution as theme with all assets
gulp.task( gulp.task(
'dist-product', 'dist-product',
gulp.series(['clean-dist-product'], function() { gulp.series(['clean-dist-product'], function () {
return gulp return gulp
.src([ .src([
'**/*', '**/*',