Skip to content

Instantly share code, notes, and snippets.

@gorork
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gorork/92de3a4316c7c00307a5 to your computer and use it in GitHub Desktop.
Save gorork/92de3a4316c7c00307a5 to your computer and use it in GitHub Desktop.
Gulpfile to compless LESS to CSS using Autoprefixer
// Include Gulp and all required plugins
var gulp = require('gulp');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var gutil = require('gulp-util');
var sourcePath = 'src/custom';
var targetPath = 'assets/css';
// Create gulp task named 'less' that
// will take 'custom.less' file from 'sourcePath' folder,
// compress it,
// add browser specific prefixes,
// minify it,
// save result CSS file into 'targetPath' folder
gulp.task('less', function () {
return gulp.src([sourcePath + '/custom.less'])
.pipe(less({compress: true}).on('error', gutil.log))
.pipe(autoprefixer('last 10 versions', 'ie 9'))
.pipe(minifyCSS({keepBreaks: false}))
.pipe(gulp.dest(targetPath));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment