Last active
October 14, 2016 10:13
-
-
Save bystrano/4e7db4f8d3a2e154a60db2d481897eca to your computer and use it in GitHub Desktop.
Un gulpfile utile pour Foundation
This file contains 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
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