Skip to content

Instantly share code, notes, and snippets.

@notflip
Created July 1, 2015 09:49
Show Gist options
  • Save notflip/3028ecc6c063852cf702 to your computer and use it in GitHub Desktop.
Save notflip/3028ecc6c063852cf702 to your computer and use it in GitHub Desktop.
Laravel Gulpfile
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var plumber = require('gulp-plumber');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('sass', function() {
gulp.src('resources/assets/sass/*.scss')
.pipe(plumber())
.pipe(autoprefixer({
cascade: false
}))
.pipe(minify())
.pipe(gulp.dest('public/css'))
.pipe(reload({stream: true}));
});
gulp.task('javascript', function() {
gulp.src('resources/assets/js/*.js')
.pipe(plumber())
.pipe(concat('all.js'))
.pipe(gulp.dest('public/js'))
.pipe(reload({stream: true}));
});
gulp.task('serve', ['sass', 'javascript'], function () {
browserSync({
proxy: 'http://127.0.0.1:8000'
});
gulp.watch("resources/views/**/*.php").on('change', reload);
gulp.watch('resources/assets/sass/*.scss', ['sass', reload]);
gulp.watch('resources/assets/js/*.js', ['javascript', reload]);
});
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment