Last active
August 16, 2022 09:06
-
-
Save danielgynn/50d9546e9163c11e799c to your computer and use it in GitHub Desktop.
Revisions
-
danielgynn revised this gist
Nov 3, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -93,4 +93,4 @@ gulp.task('default', ['serve', 'styles'], function() { gulp.watch('app/sass/**/*.scss', ['styles']); gulp.watch('app/*.html', browserSync.reload); gulp.watch('app/scripts/**/*.js', browserSync.reload); }); -
danielgynn revised this gist
Nov 3, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ var imagemin = require('gulp-imagemin'); // Minify images var size = require('gulp-size'); // Get the size of the project var browserSync = require('browser-sync'); // Reload the browser on file changes var jshint = require('gulp-jshint'); // Debug JS files var stylish = require('jshint-stylish'); // More stylish debugging // Tasks -------------------------------------------------------------------- > @@ -32,7 +33,7 @@ gulp.task('styles', function() { // Task to minify new or changed HTML pages gulp.task('html', function() { gulp.src('./app/*.html') .pipe(minifyHTML()) .pipe(gulp.dest('./build/')); }); @@ -51,7 +52,6 @@ gulp.task('images', function() { gulp.src('./app/images/*') .pipe(imagemin({ progressive: true, })) .pipe(gulp.dest('./build/images')); }); @@ -60,7 +60,7 @@ gulp.task('images', function() { gulp.task('jshint', function() { gulp.src('./app/scripts/*.js') .pipe(jshint()) .pipe(jshint.reporter('jshint-stylish')); }); // Task to get the size of the app project -
danielgynn created this gist
Nov 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,96 @@ var gulp = require('gulp'); // Require gulp // Sass dependencies var sass = require('gulp-sass'); // Compile Sass into CSS var minifyCSS = require('gulp-minify-css'); // Minify the CSS // Minification dependencies var minifyHTML = require('gulp-minify-html'); // Minify HTML var concat = require('gulp-concat'); // Join all JS files together to save space var stripDebug = require('gulp-strip-debug'); // Remove debugging stuffs var uglify = require('gulp-uglify'); // Minify JavaScript var imagemin = require('gulp-imagemin'); // Minify images // Other dependencies var size = require('gulp-size'); // Get the size of the project var browserSync = require('browser-sync'); // Reload the browser on file changes var jshint = require('gulp-jshint'); // Debug JS files // Tasks -------------------------------------------------------------------- > // Task to compile Sass file into CSS, and minify CSS into build directory gulp.task('styles', function() { gulp.src('./app/sass/styles.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./app/css')) .pipe(minifyCSS()) .pipe(gulp.dest('./build/styles/')) .pipe(browserSync.reload({ stream: true, })); }); // Task to minify new or changed HTML pages gulp.task('html', function() { return gulp.src('./app/*.html') .pipe(minifyHTML()) .pipe(gulp.dest('./build/')); }); // Task to concat, strip debugging and minify JS files gulp.task('scripts', function() { gulp.src(['./app/scripts/lib.js', './app/scripts/*.js']) .pipe(concat('script.js')) .pipe(stripDebug()) .pipe(uglify()) .pipe(gulp.dest('./build/scripts/')); }); // Task to minify images into build gulp.task('images', function() { gulp.src('./app/images/*') .pipe(imagemin({ progressive: true, svgoPlugins: [{removeViewBox: false}], })) .pipe(gulp.dest('./build/images')); }); // Task to run JS hint gulp.task('jshint', function() { gulp.src('./app/scripts/*.js') .pipe(jshint()) .pipe(jshint.reporter('default')); }); // Task to get the size of the app project gulp.task('size', function() { gulp.src('./app/**') .pipe(size({ showFiles: true, })); }); // Task to get the size of the build project gulp.task('build-size', function() { gulp.src('./build/**') .pipe(size({ showFiles: true, })); }); // Serve application gulp.task('serve', ['styles', 'html', 'scripts', 'images', 'jshint', 'size'], function() { browserSync.init({ server: { baseDir: 'app', }, }); }); // Run all Gulp tasks and serve application gulp.task('default', ['serve', 'styles'], function() { gulp.watch('app/sass/**/*.scss', ['styles']); gulp.watch('app/*.html', browserSync.reload); gulp.watch('app/scripts/**/*.js', browserSync.reload); });