Created
November 25, 2014 17:09
-
-
Save kevinSuttle/d41119c006315e9790b9 to your computer and use it in GitHub Desktop.
gulp-ruby-sass and gulp-autoprefixer
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 characters
'use strict'; | |
// Include Gulp & Tools We'll Use | |
var gulp = require('gulp'); | |
var sass = require('gulp-ruby-sass'); | |
var browserSync = require('browser-sync'); | |
var localConfig = require('./config/app.json'); | |
var stylestats = require('gulp-stylestats'); | |
var projectSize = require('gulp-size'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var AUTOPREFIXER_BROWSERS = [ | |
'ie >= 10', | |
'ie_mob >= 10', | |
'ff >= 30', | |
'chrome >= 34', | |
'safari >= 7', | |
'opera >= 23', | |
'ios >= 7', | |
'android >= 4.4', | |
'bb >= 10' | |
]; | |
// Build Production Files, the Default Task | |
gulp.task('default', ['serve', 'styles', 'browser-sync'], function() { | |
gulp.watch(['sass/**/*.scss'], ['styles']); | |
gulp.watch(['public/css/*.css}'], [browserSync.reload]); | |
}); | |
// Locally sync devices on the same WiFi network | |
gulp.task('browser-sync', function(){ | |
browserSync({ | |
proxy: localConfig.host + ":" + localConfig.port, | |
open: false | |
}) | |
}) | |
// Compile SASS Stylesheets | |
gulp.task('styles', function () { | |
return sass('sass/') | |
.pipe(autoprefixer({ | |
browsers: AUTOPREFIXER_BROWSERS, | |
cascade: false | |
})) | |
//.pipe(stylestats()) | |
.pipe(gulp.dest('public/css')) | |
.pipe(projectSize({'showFiles': true, 'gzip': false})) | |
.pipe(projectSize({'showFiles': true, 'gzip': true})) | |
.pipe(browserSync.reload({stream: true})); | |
}); | |
// Start Express Server | |
gulp.task('serve', function () { | |
var spawn = require('child_process').spawn; | |
var expressServer = spawn('npm', ['start'], {stdio: 'inherit'}); | |
expressServer.on('exit', function (code) { | |
gulpCallBack(code === 0 ? null : 'ERROR: Express server process exited with code: ' + code); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment