Created
November 9, 2015 21:38
-
-
Save ScottKaye/83f00579754b394f07d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"); | |
var buffer = require("vinyl-buffer"); | |
var source = require("vinyl-source-stream"); | |
var sourcemaps = require("gulp-sourcemaps"); | |
var sass = require("gulp-ruby-sass"); | |
var rename = require("gulp-rename"); | |
var autoprefixer = require("gulp-autoprefixer"); | |
var minifycss = require("gulp-minify-css"); | |
var browserify = require("browserify"); | |
gulp.task("sass", function () { | |
return sass("style/*.scss") | |
.on("error", sass.logError) | |
.pipe(autoprefixer({ | |
browsers: ["last 10 versions", "> 5%"], | |
cascade: false | |
})) | |
.pipe(minifycss()) | |
.pipe(rename("style/app.css")) | |
.pipe(gulp.dest("")); | |
}); | |
gulp.task("js", function() { | |
var bundler = browserify("js/src/app-base.js", { | |
debug: true | |
}) | |
.transform("babelify", { | |
presets: ["es2015", "stage-0"] | |
}); | |
return bundler.bundle() | |
.on("error", function(err) { | |
console.error(err); | |
this.emit("end"); | |
}) | |
.pipe(source("app.js")) | |
.pipe(buffer()) | |
.pipe(sourcemaps.init({ loadMaps: true })) | |
.pipe(sourcemaps.write("./")) | |
.pipe(gulp.dest("js/dist/")); | |
}); | |
gulp.task("default", function(){ | |
gulp.watch("style/*.scss", ["sass"]); | |
gulp.watch("js/src/*.js", ["js"]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment