Compressing JS and CSS

This commit is contained in:
Jeff Avallone 2015-11-01 11:32:05 -05:00
parent 2a338595d5
commit e1bc209590
2 changed files with 7 additions and 2 deletions

View File

@ -18,6 +18,7 @@ const gulp = require('gulp-help')(require('gulp')),
karma = require('karma'), karma = require('karma'),
path = require('path'), path = require('path'),
jscs = require('gulp-jscs'), jscs = require('gulp-jscs'),
uglify = require('gulp-uglify'),
config = require('./config'); config = require('./config');
gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() { 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() { gulp.task('markup:svg_styles', false, function() {
return gulp.src('./src/sass/svg.scss') return gulp.src('./src/sass/svg.scss')
.pipe(sass({ .pipe(sass({
includePaths: bourbon.includePaths includePaths: bourbon.includePaths,
outputStyle: 'compressed'
})) }))
.on('error', notify.onError()) .on('error', notify.onError())
.pipe(rename({ .pipe(rename({
@ -101,7 +103,8 @@ gulp.task('styles', 'Build stylesheets into ./build directory.', function() {
return gulp.src('./src/sass/main.scss') return gulp.src('./src/sass/main.scss')
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe(sass({ .pipe(sass({
includePaths: bourbon.includePaths includePaths: bourbon.includePaths,
outputStyle: 'compressed'
})) }))
.on('error', notify.onError()) .on('error', notify.onError())
.pipe(rename({ dirname: '' })) .pipe(rename({ dirname: '' }))
@ -119,6 +122,7 @@ gulp.task('scripts', 'Build scripts into ./build directory', function() {
.pipe(source('./src/js/main.js')) .pipe(source('./src/js/main.js'))
.pipe(buffer()) .pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true })) .pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(rename({ dirname: '' })) .pipe(rename({ dirname: '' }))
.pipe(sourcemaps.write('.')) .pipe(sourcemaps.write('.'))
.pipe(gulp.dest(config.buildPath('js'))); .pipe(gulp.dest(config.buildPath('js')));

View File

@ -26,6 +26,7 @@
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-sass": "^2.1.0", "gulp-sass": "^2.1.0",
"gulp-sourcemaps": "^1.6.0", "gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.4.2",
"handlebars-layouts": "^3.1.2", "handlebars-layouts": "^3.1.2",
"jasmine-core": "^2.3.4", "jasmine-core": "^2.3.4",
"karma": "^0.13.14", "karma": "^0.13.14",