From e1bc2095909333474f8840a3faba2811ed05061b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 1 Nov 2015 11:32:05 -0500 Subject: [PATCH] Compressing JS and CSS --- gulpfile.js | 8 ++++++-- package.json | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b75dbde..8471bad 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,6 +18,7 @@ const gulp = require('gulp-help')(require('gulp')), karma = require('karma'), path = require('path'), jscs = require('gulp-jscs'), + uglify = require('gulp-uglify'), config = require('./config'); gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() { @@ -86,7 +87,8 @@ gulp.task('markup', 'Build markup into ./build directory.', ['markup:svg_styles' gulp.task('markup:svg_styles', false, function() { return gulp.src('./src/sass/svg.scss') .pipe(sass({ - includePaths: bourbon.includePaths + includePaths: bourbon.includePaths, + outputStyle: 'compressed' })) .on('error', notify.onError()) .pipe(rename({ @@ -101,7 +103,8 @@ gulp.task('styles', 'Build stylesheets into ./build directory.', function() { return gulp.src('./src/sass/main.scss') .pipe(sourcemaps.init()) .pipe(sass({ - includePaths: bourbon.includePaths + includePaths: bourbon.includePaths, + outputStyle: 'compressed' })) .on('error', notify.onError()) .pipe(rename({ dirname: '' })) @@ -119,6 +122,7 @@ gulp.task('scripts', 'Build scripts into ./build directory', function() { .pipe(source('./src/js/main.js')) .pipe(buffer()) .pipe(sourcemaps.init({ loadMaps: true })) + .pipe(uglify()) .pipe(rename({ dirname: '' })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest(config.buildPath('js'))); diff --git a/package.json b/package.json index e0dbd2c..1888b29 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "gulp-rename": "^1.2.2", "gulp-sass": "^2.1.0", "gulp-sourcemaps": "^1.6.0", + "gulp-uglify": "^1.4.2", "handlebars-layouts": "^3.1.2", "jasmine-core": "^2.3.4", "karma": "^0.13.14",