-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
68 lines (61 loc) · 2.1 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var gulp = require('gulp');
var watch = require('gulp-watch');
var stylus = require('gulp-stylus');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var uglify = require('gulp-uglifyjs');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var vulcanize = require('gulp-vulcanize');
// src sets
var cssBundle = [
'./public/components/materialize/dist/css/materialize.min.css',
'./public/stylesheets/styl/main.styl'
];
var jsBundle = [
'./public/components/jquery/dist/jquery.min.js',
'./public/components/materialize/dist/js/materialize.min.js'
];
var webCompBundle = [
//'./public/components/polymer/polymer.html',
//'./public/components/polymer/layout.html',
'./public/components/perf-metrics/perf-metrics.html',
'./public/components/perf-offenders/perf-offenders.html'
];
gulp.task('stylus', function () {
gulp.src(cssBundle)
.pipe(stylus({compress: true}).on('error', gutil.log))
.pipe(autoprefixer('last 10 versions', 'ie 9'))
.pipe(minifyCSS({keepBreaks: false}))
.pipe(concat('main.min.css'))
.pipe(gulp.dest('./public/stylesheets'))
.pipe(notify('Stylus Compiled, Prefixed and Minified'));
});
gulp.task('js-bundle',function(){
gulp.src(jsBundle)
.pipe(uglify('app.min.js'))
.pipe(gulp.dest('./public/javascripts'))
.pipe(notify('JS Bundle Concatenated & Uglified'));
});
gulp.task('webcomponents',function(){
var destDir = 'public/webcomponents';
return gulp.src(webCompBundle)
.pipe(vulcanize({
dest:destDir,
strip: true
}))
.pipe(gulp.dest(destDir))
.pipe(notify('Webcomponents Bundle Vulcanized!'));
});
// watches
gulp.task('watch', function () {
gulp.watch('public/stylesheets/styl/*', ['stylus']);
gulp.watch('public/components/**/*.html', ['webcomponents']);
});
// build tasks
gulp.task('build',['js-bundle','stylus','webcomponents']);
// default tasks
gulp.task('default',['build','watch']);