Skip to content

Commit

Permalink
gulp4 + babel
Browse files Browse the repository at this point in the history
  • Loading branch information
chmln committed Apr 12, 2016
1 parent d34876c commit b00f7ba
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [ "es2015" ]
}
52 changes: 52 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import gulp from "gulp"
import stylus from "gulp-stylus"
import babel from "gulp-babel"
import cssmin from "gulp-cssmin"
import uglify from "gulp-uglify"
import rename from "gulp-rename"

const paths = {
style: "src/style/flatpickr.styl",
script: "src/flatpickr.js",
themes: "./src/style/themes/*.styl"
};

export function script() {
return gulp.src(paths.script)
.pipe(babel({presets: ['es2015']}))
.pipe(uglify()).on('error', errorHandler)
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest('dist'));
};

export function style() {
return gulp.src(paths.style)
.pipe(stylus())
.pipe(cssmin()).on('error', errorHandler)
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest('dist'));
};

export function themes() {
return gulp.src(paths.themes)
.pipe(stylus())
.pipe(cssmin()).on('error', errorHandler)
.pipe(rename({ prefix: 'flatpickr.',suffix: '.min'}))
.pipe(gulp.dest('dist'));
};

export function watch() {
gulp.watch('./src/style/*.styl', style);
gulp.watch('./src/style/themes/*.styl', themes);
gulp.watch(paths.script, script);
};


// Handle the error
function errorHandler (error) {
console.log(error.toString());
}

const build = gulp.parallel(script, style, themes,watch);
export {build}
export default build;
48 changes: 0 additions & 48 deletions gulpfile.js

This file was deleted.

0 comments on commit b00f7ba

Please sign in to comment.