wixoss-fetch/gulpfile.js

34 lines
806 B
JavaScript
Raw Permalink Normal View History

2016-10-16 15:30:11 +02:00
'use strict'
let gulp = require('gulp')
let browserify = require('browserify')
let source = require('vinyl-source-stream')
let buffer = require('vinyl-buffer')
let sourcemaps = require('gulp-sourcemaps')
let del = require('del')
let path = {
2016-10-16 18:45:33 +02:00
dist: './dist/',
2016-10-16 15:30:11 +02:00
}
gulp.task('clean', function () {
2016-10-16 18:45:33 +02:00
return del([path.dist])
2016-10-16 15:30:11 +02:00
})
gulp.task('static', ['clean'], function () {
return gulp.src('./static/*')
2016-10-16 18:45:33 +02:00
.pipe(gulp.dest(path.dist))
2016-10-16 15:30:11 +02:00
})
gulp.task('script', ['clean'], function () {
return browserify('./src/index.js', { debug: true })
.bundle()
2016-10-16 18:45:33 +02:00
.pipe(source('index.js'))
2016-10-16 15:30:11 +02:00
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
2016-10-16 18:45:33 +02:00
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(path.dist))
2016-10-16 15:30:11 +02:00
})
gulp.task('build', ['clean', 'static', 'script'])