-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
69 lines (60 loc) · 1.89 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
69
var gulp = require('gulp'),
gp = require('gulp-load-plugins')({lazy: false}),
coffee = require('gulp-coffee'),
uglify = require('gulp-uglify'),
filter = require('gulp-filter'),
bowerFiles = require('main-bower-files'),
concat = require('gulp-concat'),
browserify = require('browserify'),
sourcemaps = require('gulp-sourcemaps'),
gutil = require('gulp-util'),
watch = require('gulp-watch'),
buffer = require('vinyl-buffer'),
source = require('vinyl-source-stream');
gulp.task('ext-js', function() {
gulp.src(bowerFiles())
.pipe(filter("**/*.js"))
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(concat('vendor.js'))
.pipe(uglify()).on('error', gutil.log)
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest('public/dist'))
});
gulp.task('ext-css', function() {
console.log(bowerFiles())
gulp.src(bowerFiles())
.pipe(filter("**/*.css"))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(concat('vendor.css'))
.pipe(gulp.dest('public/dist'))
});
gulp.task('icons', function() {
gulp.src(bowerFiles())
.pipe(filter("**/*.{eot,svg,ttf,woff,woff2}"))
.pipe(gulp.dest('public/fonts'));
});
gulp.task('coffee', function() {
bundler = browserify({
entries: ["./lib/script.coffee"],
debug: true,
extensions: [".coffee", ".js"]
})
bundler
.transform('coffeeify')
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify()).on('error', gutil.log)
.pipe(sourcemaps.write())
.pipe(gulp.dest('public/dist'))
});
gulp.task('watch', function() {
gulp.watch("bower_components/**/*.js", ['ext-js']);
gulp.watch("bower_components/**/*.css", ['ext-css'] );
gulp.watch("lib/**/*.coffee", ['coffee'] );
});
gulp.task('default',
['ext-js', 'coffee', 'ext-css', 'icons', 'watch']
);