-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
executable file
·51 lines (41 loc) · 1.4 KB
/
Gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var gulp = require("gulp");
var uglify = require('gulp-uglify');
var sourcemaps = require("gulp-sourcemaps");
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var clean = require('gulp-clean');
gulp.task('default', ['watch']);
gulp.task("js", function () {
var b = browserify({
entries: 'assets/javascripts/index.js',
debug: true
});
b.bundle()
.pipe(source('oxtransit.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./public/javascripts'));
});
gulp.task('sass', function () {
gulp.src('./assets/stylesheets/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./public/stylesheets'));
});
gulp.task('watch', ["build", "watchTask"]);
gulp.task('watchTask', function() {
gulp.watch(['./assets/**/*.js', './assets/**/*.scss'], ['buildQuick']);
});
gulp.task('images', function() {
gulp.src('./assets/images/**/*').pipe(gulp.dest('./public/images/'));
});
gulp.task('clean', function() {
gulp.src('./public/images/*', {read: false}).pipe(clean());
});
gulp.task("build", ["clean", "images", "js", "sass"]);
gulp.task("buildQuick", ["js", "sass"]);