Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Un gulpfile utile pour Foundation
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var argv = require('yargs').argv;
var port = process.env.SERVER_PORT || 3000;
var browser = require('browser-sync');
// Check for --production flag
var isProduction = !!(argv.production);
var sassPaths = [
'bower_components/foundation-sites/scss',
'bower_components/motion-ui/src'
];
// Starts a BrowerSync instance.
gulp.task('serve', ['sass'], function() {
browser.create().init({
server: './',
port: port,
index: "decoupe-home.html"
});
});
// Compiles the sass stylesheets.
gulp.task('sass', function() {
return gulp.src('./scss/app.scss')
.pipe($.sourcemaps.init())
.pipe($.sass({
includePaths: sassPaths,
outputStyle: 'compressed'
})
.on('error', $.sass.logError))
.pipe($.autoprefixer({
browsers: ['last 2 versions', 'ie >= 9']
}))
.pipe($.minifyCss())
.pipe($.if( ! isProduction, $.sourcemaps.write('../css')))
.pipe(gulp.dest('./css'));
});
// foundation watch
gulp.task('default', ['serve', 'sass'], function() {
gulp.watch(['./scss/**/*.scss'], ['sass', browser.reload]);
gulp.watch(['*.html'], [browser.reload]);
});
// foundation build
gulp.task('build', ['sass']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment