2015-04-14 10:04:17 +02:00
|
|
|
// Requires
|
|
|
|
var gulp = require('gulp');
|
|
|
|
|
|
|
|
// Include plugins
|
2018-10-31 15:24:17 +01:00
|
|
|
var postcss = require('gulp-postcss');
|
2016-05-16 15:45:14 +02:00
|
|
|
var sass = require('gulp-sass');
|
2015-04-14 10:04:17 +02:00
|
|
|
var rename = require('gulp-rename');
|
2018-10-31 15:24:17 +01:00
|
|
|
|
|
|
|
var cssnano = require('cssnano'); // minifies CSS
|
|
|
|
var autoprefixer = require('autoprefixer');
|
|
|
|
|
|
|
|
var unprefix = require("postcss-unprefix"); // deletes old prefixes
|
|
|
|
var flexbugs = require('postcss-flexbugs-fixes'); // flexbox fixes for IE
|
|
|
|
var gaps = require('postcss-gap-properties'); // gaps polyfill
|
|
|
|
|
|
|
|
var browsersList = [
|
|
|
|
'> 1%',
|
|
|
|
'last 2 versions',
|
|
|
|
'IE >= 10', 'Edge >= 16',
|
|
|
|
'Chrome >= 60',
|
|
|
|
'Firefox >= 50', 'Firefox ESR',
|
|
|
|
'Safari >= 10',
|
|
|
|
'ios_saf >= 10',
|
|
|
|
'Android >= 5'
|
|
|
|
];
|
|
|
|
|
|
|
|
var plugins = [
|
|
|
|
unprefix(),
|
|
|
|
autoprefixer({
|
|
|
|
grid: true,
|
|
|
|
browsers: browsersList
|
|
|
|
}),
|
|
|
|
flexbugs(),
|
|
|
|
gaps()
|
|
|
|
];
|
|
|
|
|
|
|
|
var pluginsProd = [
|
|
|
|
unprefix(),
|
|
|
|
autoprefixer({
|
|
|
|
grid: true,
|
|
|
|
browsers: browsersList
|
|
|
|
}),
|
|
|
|
flexbugs(),
|
|
|
|
gaps(),
|
|
|
|
cssnano()
|
|
|
|
];
|
2015-04-14 10:04:17 +02:00
|
|
|
|
2018-10-31 15:24:17 +01:00
|
|
|
// tâche cssDev = compile vers knacss-unminified.css
|
|
|
|
gulp.task('cssDev', function () {
|
|
|
|
return gulp.src('./sass/knacss.scss')
|
|
|
|
.pipe(sass({
|
|
|
|
outputStyle: 'expanded' // CSS non minifiée plus lisible ('}' à la ligne)
|
|
|
|
}))
|
|
|
|
.pipe(postcss(plugins))
|
|
|
|
.pipe(rename('knacss-unminified.css'))
|
|
|
|
.pipe(gulp.dest('./css/'));
|
|
|
|
});
|
|
|
|
|
|
|
|
// tâche cssProd = compile vers knacss.css minifié
|
|
|
|
gulp.task('cssProd', function () {
|
|
|
|
return gulp.src('./sass/knacss.scss')
|
|
|
|
.pipe(sass())
|
|
|
|
.pipe(postcss(pluginsProd))
|
2015-04-14 10:04:17 +02:00
|
|
|
.pipe(gulp.dest('./css/'));
|
|
|
|
});
|
|
|
|
|
2016-02-12 16:23:20 +01:00
|
|
|
gulp.task('grillade', function() {
|
2018-01-04 11:10:34 +01:00
|
|
|
return gulp.src('./sass/_library/grillade-grid.scss')
|
2016-05-16 15:45:14 +02:00
|
|
|
.pipe(sass())
|
2018-10-31 15:24:17 +01:00
|
|
|
.pipe(postcss(pluginsProd))
|
2015-12-24 09:04:43 +01:00
|
|
|
.pipe(gulp.dest('./css/'));
|
|
|
|
});
|
|
|
|
|
2017-10-24 15:07:13 +02:00
|
|
|
gulp.task('grillade-flex', function() {
|
2018-01-04 11:10:34 +01:00
|
|
|
return gulp.src('./sass/_library/grillade-flex.scss')
|
2017-08-28 12:22:44 +02:00
|
|
|
.pipe(sass())
|
2018-10-31 15:24:17 +01:00
|
|
|
.pipe(postcss(pluginsProd))
|
2017-08-28 12:22:44 +02:00
|
|
|
.pipe(gulp.dest('./css/'));
|
|
|
|
});
|
|
|
|
|
2015-04-14 10:04:17 +02:00
|
|
|
// Watcher
|
|
|
|
gulp.task('watch', function() {
|
2018-12-10 17:17:32 +01:00
|
|
|
gulp.watch(['./sass/*.scss'], ['cssDev']);
|
2015-04-14 10:04:17 +02:00
|
|
|
});
|
|
|
|
|
2015-12-24 11:16:13 +01:00
|
|
|
|
2018-10-31 15:24:17 +01:00
|
|
|
gulp.task('default', ['cssDev', 'cssProd', 'grillade', 'grillade-flex']);
|