Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulp task : just CSS
//{
// "name": "demo",
// "version": "0.0.0",
// "devDependencies": {
// "gulp": "latest",
// "gulp-autoprefixer": "latest",
// "gulp-cssbeautify": "latest",
// "gulp-csscomb": "latest",
// "gulp-load-plugins": "latest",
// "gulp-less": "latest",
// "gulp-rename": "latest",
// "gulp-csso": "latest"
// }
//}
// Requires
var gulp = require('gulp');
// Include plugins
var plugins = require('gulp-load-plugins')(); // tous les plugins de package.json
// Variables de chemins
var source = './src/'; // dossier de travail
var destination = './dist/'; // dossier à livrer
var lessMain= 'assets/css/styles.less'; // fichier Less principal
var lessFiles= 'assets/css/{,includes/}*.less'; // fichiers Less à surveiller
// Tâche "css" = LESS + autoprefixer + CSScomb + beautify + minify
gulp.task('css', function () {
return gulp.src(source + lessMain)
.pipe(plugins.less())
.pipe(plugins.csscomb())
.pipe(plugins.cssbeautify({indent: ' '}))
.pipe(plugins.autoprefixer())
.pipe(gulp.dest(destination + 'assets/css/'))
.pipe(plugins.rename({suffix: '.min'}))
.pipe(plugins.csso())
.pipe(gulp.dest(destination + 'assets/css/'));
});
// Watch Files For Changes
gulp.task('watch', function () {
gulp.watch('./src/assets/css/*.less', ['css']);
});
// Tasks
gulp.task('default', ['css']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.