Skip to content

Instantly share code, notes, and snippets.

@ozziexsh
Created April 12, 2016 17:47
Show Gist options
  • Save ozziexsh/948cecfb9ef8d0a002a2a21829f95546 to your computer and use it in GitHub Desktop.
Save ozziexsh/948cecfb9ef8d0a002a2a21829f95546 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var SOURCES = {
js: [
],
scss: [
]
}
gulp.task('js', function () {
gulp.src(SOURCES.js)
.pipe(sourcemaps.init())
.pipe(concat('bundle.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/dist/'))
});
gulp.task('scss', function() {
return gulp.src(SOURCES.scss)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(concat("bundle.css"))
.pipe(cssnano())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/dist/'));
});
gulp.task('watch', ['js', 'scss'], function () {
gulp.watch('public/js/**/*.js', ['js']);
gulp.watch('resources/assets/sass/**/*.scss', ['scss']);
});
gulp.task('default', ['watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment