Skip to content

Instantly share code, notes, and snippets.

@bystrano
Last active October 14, 2016 10:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bystrano/4e7db4f8d3a2e154a60db2d481897eca to your computer and use it in GitHub Desktop.
Save bystrano/4e7db4f8d3a2e154a60db2d481897eca to your computer and use it in GitHub Desktop.
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