Skip to content

Instantly share code, notes, and snippets.

@dextel2 dextel2/gulpfile.js
Created Nov 1, 2018

Embed
What would you like to do?
My personal gist
const gulp = require("gulp");
const sass = require("gulp-sass");
const concat = require("gulp-concat");
const cssnano = require("gulp-cssnano");
const uglify = require("gulp-uglify");
const prefix = require("gulp-autoprefixer");
let autoPrefixer = [
"> 1%",
"last 2 versions",
"firefox >= 4",
"safari 7",
"safari 8",
"IE 8",
"IE 9",
"IE 10",
"IE 11"
];
gulp.task("default", ["watch"]);
gulp.task("watch", ["sass", "scripts"], function() {
gulp.watch("public/sass/**/*.scss", ["sass"]);
gulp.watch("public/js/main.js", ["scripts"]);
});
gulp.task("sass", function() {
return gulp
.src("public/sass/**/*.scss")
.pipe(sass())
.pipe(cssnano())
.pipe(prefix({ browsers: autoPrefixer }))
.pipe(concat("styles.min.css"))
.pipe(gulp.dest("public/css"));
});
gulp.task("scripts", function() {
return gulp
.src("public/js/main.js")
.pipe(concat("main.min.js"))
.pipe(uglify())
.pipe(gulp.dest("public/js"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.