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