fathom/gulpfile.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

'use strict';
// TODO: Minify JS
const babelify = require("babelify");
const browserify = require('browserify');
const gulp = require('gulp');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const rename = require('gulp-rename');
const gutil = require('gulp-util');
const sass = require('gulp-sass');
gulp.task('default', [ 'browserify', 'sass' ] );
gulp.task('browserify', function () {
return browserify({
entries: './assets/js/script.js',
debug: true
})
.transform("babelify", {presets: ["es2015"]})
.bundle()
.on('error', function(err){
console.log(err.message);
this.emit('end');
})
.pipe(source('script.js'))
.pipe(buffer())
2016-11-22 19:57:16 +00:00
.pipe(gulp.dest('./static/js/'))
});
gulp.task('sass', function () {
var files = './assets/sass/[^_]*.scss';
return gulp.src(files)
.pipe(sass())
.on('error', gutil.log)
.pipe(rename({ extname: '.css' }))
2016-11-22 19:57:16 +00:00
.pipe(gulp.dest('./static/css'))
});
gulp.task('watch', ['default'], function() {
2016-11-21 16:36:25 +00:00
gulp.watch(['./assets/js/**/*.js'], ['browserify'] );
2016-11-25 12:38:20 +00:00
gulp.watch(['./assets/sass/**/*.scss'], ['sass'] );
});