cleanup gulpfile.js

This commit is contained in:
koenemann 2016-12-22 09:55:28 +01:00
parent 56b579bd76
commit edb2e25fe3
1 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,7 @@ var basePaths = {
dev: './src/' dev: './src/'
}; };
// browser-sync watched files // browser-sync watched files
// automatically reloads the page when files changed // automatically reloads the page when files changed
var browserSyncWatchFiles = [ var browserSyncWatchFiles = [
@ -12,6 +13,8 @@ var browserSyncWatchFiles = [
'./js/*.min.js', './js/*.min.js',
'./**/*.php' './**/*.php'
]; ];
// browser-sync options // browser-sync options
// see: https://www.browsersync.io/docs/options/ // see: https://www.browsersync.io/docs/options/
var browserSyncOptions = { var browserSyncOptions = {
@ -19,6 +22,7 @@ var browserSyncOptions = {
notify: false notify: false
}; };
// Defining requirements // Defining requirements
var gulp = require('gulp'); var gulp = require('gulp');
var plumber = require('gulp-plumber'); var plumber = require('gulp-plumber');
@ -88,6 +92,7 @@ gulp.task('sass', function () {
.pipe(gulp.dest('./css')); .pipe(gulp.dest('./css'));
}); });
// Run: // Run:
// gulp watch // gulp watch
// Starts watcher. Watcher runs gulp sass task on changes // Starts watcher. Watcher runs gulp sass task on changes
@ -97,6 +102,7 @@ gulp.task('watch', function () {
gulp.watch([basePaths.dev + 'js/**/*.js'], ['scripts']) gulp.watch([basePaths.dev + 'js/**/*.js'], ['scripts'])
}); });
// Run: // Run:
// gulp nanocss // gulp nanocss
// Minifies CSS files // Minifies CSS files
@ -117,6 +123,7 @@ gulp.task('cleancss', function() {
.pipe(rimraf()); .pipe(rimraf());
}); });
// Run: // Run:
// gulp browser-sync // gulp browser-sync
// Starts browser-sync task for starting the server. // Starts browser-sync task for starting the server.
@ -124,11 +131,13 @@ gulp.task('browser-sync', function() {
browserSync.init(browserSyncWatchFiles, browserSyncOptions); browserSync.init(browserSyncWatchFiles, browserSyncOptions);
}); });
// Run: // Run:
// gulp watch-bs // gulp watch-bs
// Starts watcher with browser-sync. Browser-sync reloads page automatically on your browser // Starts watcher with browser-sync. Browser-sync reloads page automatically on your browser
gulp.task('watch-bs', ['browser-sync', 'watch', 'cssnano', 'scripts'], function () { }); gulp.task('watch-bs', ['browser-sync', 'watch', 'cssnano', 'scripts'], function () { });
// Run: // Run:
// gulp scripts. // gulp scripts.
// Uglifies and concat all JS files into one // Uglifies and concat all JS files into one
@ -163,6 +172,7 @@ gulp.task('scripts', function() {
.pipe(gulp.dest('./js/')); .pipe(gulp.dest('./js/'));
}); });
// Run: // Run:
// gulp copy-assets. // gulp copy-assets.
// 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
@ -221,6 +231,7 @@ gulp.task('copy-assets', function() {
.pipe(gulp.dest(basePaths.dev + '/css')); .pipe(gulp.dest(basePaths.dev + '/css'));
}); });
// Run // Run
// gulp dist // gulp dist
// Copies the files to the /dist folder for distributon // Copies the files to the /dist folder for distributon