Skip to content

Instantly share code, notes, and snippets.

@felixfong227
Last active February 18, 2017 09:47
Show Gist options
  • Save felixfong227/a8303377950731b677ffcc732fd644be to your computer and use it in GitHub Desktop.
Save felixfong227/a8303377950731b677ffcc732fd644be to your computer and use it in GitHub Desktop.
ES5, SCSS build script
const gulp = require("gulp")
,uglify = require('gulp-uglify')
,babel = require('gulp-babel')
,scss = require("gulp-sass")
,browserify = require("gulp-browserify")
,rename = require('gulp-rename')
;
const paths = {
scripts: ['bin/js/**/*.js']
,scss: ["bin/scss/**/*.scss"]
};
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.scss, ['scss']);
});
gulp.task("scripts", () => {
gulp.src(paths.scripts)
.pipe(babel({
presets: ['es2015']
}))
.pipe(uglify())
.pipe(browserify())
.pipe(rename("pony-player.min.js"))
.pipe(gulp.dest("./build/js/"))
});
gulp.task("scss", () => {
gulp.src(paths.scss)
.pipe(scss({outputStyle: 'compressed'}).on('error', scss.logError))
.pipe(rename("pony-player.min.css"))
.pipe(gulp.dest('./build/css'))
});
gulp.task("default",[
"scripts"
,"scss"
,"watch"
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment