forked from skol-pro/ion-digit-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
61 lines (54 loc) · 1.65 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
var gulp = require('gulp');
var del = require('del');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ngHtml2Js = require("gulp-ng-html2js");
var minifyHtml = require("gulp-minify-html");
var minifyCss = require('gulp-minify-css');
var css2js = require("gulp-css2js");
var sass = require('gulp-sass');
var rename = require('gulp-rename');
gulp.task('clean', function () {
del(['dist/*']);
});
gulp.task('sass', function (done) {
gulp.src('./src/*.scss')
.pipe(sass())
.on('error', sass.logError)
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./dist/'))
.on('end', done);
});
gulp.task('html2js', function () {
return gulp.src(['./src/*.html'])
.pipe(minifyHtml())
.pipe(ngHtml2Js({
moduleName: "ion-digit-keyboard.templates"
}))
.pipe(concat("templates.js"))
.pipe(uglify())
.pipe(gulp.dest("./dist"));
});
gulp.task('css2js', ['sass'], function () {
return gulp.src("./dist/*.css")
.pipe(css2js())
.pipe(uglify())
.pipe(gulp.dest("./dist/"));
});
gulp.task('bundle', ['clean', 'html2js', 'css2js'], function (done) {
gulp.src(['./dist/*.js', './src/*.js'])
.pipe(concat('ion-digit-keyboard.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/'))
.on('end', function () {
del(['dist/templates.js', 'dist/ion-digit-keyboard.min.css']);
done();
});
});
gulp.task('default', ['bundle']);
gulp.task('watch', function () {
gulp.watch('./src/*', ['bundle']);
});