forked from alirezamirian/angular-material-lightbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
67 lines (60 loc) · 1.91 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
var gulp = require("gulp");
var $ = require("gulp-load-plugins")();
var ngHtml2Js = require("gulp-ng-html2js"); // don't know why it's not captured by gulp-load-plugins!
var runSequence = require('gulp-run-sequence');
var pkg = require("./bower.json");
var streamqueue = require('streamqueue');
var srcPath = "src";
var distPath = "dist";
var demoDistPath = "demo/dist";
var outputName = "ame-lightbox";
var banner = '/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' * <%= pkg.repository %>\n' +
'*/\n\n';
gulp.task("build", ["build-js", "build-css"]);
gulp.task("watch", watch);
gulp.task("build-js", buildJs);
gulp.task("build-css", buildCss);
function watch(){
gulp.watch([srcPath + "/**/*.js", srcPath + "/**/*.html"], buildJs);
gulp.watch(srcPath + "/**/*.scss", buildCss);
}
function buildJs(){
return streamqueue(
{
objectMode: true
},
gulp.src(srcPath + "/**/*.js")
.pipe($.angularFilesort())
.pipe($.ngAnnotate()),
getHtmlAndSvgJsStream()
)
.pipe($.plumber())
.pipe($.concat(outputName + ".js"))
.pipe($.stripBanner())
.pipe($.banner(banner,{
pkg: pkg
}))
.pipe(gulp.dest(distPath))
.pipe(gulp.dest(demoDistPath))
.pipe($.uglify())
.pipe($.rename({suffix: ".min"}))
.pipe(gulp.dest(distPath));
}
function buildCss(){
gulp.src(srcPath + "/**/*.scss")
.pipe($.plumber())
.pipe($.sass())
.pipe($.concatCss(outputName + ".css"))
.pipe(gulp.dest(distPath))
.pipe(gulp.dest(demoDistPath))
.pipe($.minifyCss())
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest(distPath));
}
function getHtmlAndSvgJsStream(){
return gulp.src([srcPath + "/**/*.html", srcPath + "/**/*.svg"])
.pipe(ngHtml2Js({base: srcPath, moduleName: 'ame.lightbox'}));
}