-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
47 lines (44 loc) · 1.52 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
var gulp = require('gulp');
var streamify = require('gulp-streamify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
// var buffer = require('vinyl-buffer');
var path = require('path');
var less = require('gulp-less');
var minifyCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
// var ngAnnotate = require('gulp-ng-annotate');
// var concat = require('gulp-concat')
//var babel = require('babelify');
gulp.task('browserify', function () {
// Grabs the app.js file
return browserify('./src/js/app.js', { debug: true })
//.transform(babel, { presets: ['es2015'] })
// bundles it and creates a file called main.js
.bundle()
.pipe(source('main.min.js'))
// .pipe(streamify(uglify({ mangle: false })))
// .pipe(buffer())
// .pipe(uglify())
// saves it the public/js/ directory
.pipe(gulp.dest('public'));
});
gulp.task('minify-js', function() {
return browserify('./src/js/app.js', { debug: true })
.bundle()
.pipe(source('main.min.js'))
.pipe(streamify(uglify({ mangle: false })))
.pipe(gulp.dest('public'));
});
gulp.task('watch', function () {
gulp.watch('./src/js/**/*.js', ['browserify'])
});
gulp.task('css', function () {
return gulp.src('./src/css/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'src/css', 'includes') ]
}))
// .pipe(source('custom.css'))
.pipe(gulp.dest('./public/css'));
});
gulp.task('default', ['minify-js','css']);