Skip to content

Instantly share code, notes, and snippets.

@justinwhall
Last active June 27, 2016 20:37
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 justinwhall/b84cf83e3b05f7910a10b59bf520c6cf to your computer and use it in GitHub Desktop.
Save justinwhall/b84cf83e3b05f7910a10b59bf520c6cf to your computer and use it in GitHub Desktop.
// dependancies
var gulp = require('gulp');
var less = require('gulp-less');
var path = require('path');
var rename = require("gulp-rename");
var eventStream = require('event-stream');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
var browserSync = require('browser-sync').create();
// compile public LESS
gulp.task('compileLess', function () {
return admin = gulp.src('assets/css/less/bootstrapwp.less')
.pipe(plumber(onError))
.pipe(less({
filename: 'bootstrapwp.less',
compress: true
}))
.pipe(rename('bootstrapwp.min.css'))
.pipe(gulp.dest('assets/css/'))
.pipe(browserSync.stream());
});
// gulp watch function. Calls
gulp.task('watch', ['compileLess'], function(gulpCallback){
browserSync.init({
proxy: 'http://localhost:8888', //Change to local dev url...
},
function callback() {
// watch all view files and reload on change
gulp.watch(['./**/*.php', './js/**/*.js'], browserSync.reload);
gulp.watch('assets/css/less/bootstrapwp.less', ['compileLess']);
// notify gulp that this task is done
gulpCallback();
});
});
// log errors to the terminal and don't break node stream
var onError = function (err) {
gutil.beep();
console.log(err);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment