-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (42 loc) · 1.43 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
var gulp = require('gulp');
var del = require('del');
var concat = require('gulp-concat');
var css2js = require("gulp-css2js");
var minifyHtml = require("gulp-minify-html");
var ngHtml2Js = require("gulp-ng-html2js");
var uglify = require('gulp-uglify');
var sass = require('gulp-sass');
gulp.task('html2js', function () {
return gulp.src(['./src/templates/*.html'])
.pipe(minifyHtml())
.pipe(ngHtml2Js({
moduleName: "onezone-datepicker.templates"
}))
.pipe(concat("templates.js"))
.pipe(uglify())
.pipe(gulp.dest("./dist"));
});
gulp.task('sass2css', function () {
gulp.src('./src/style/onezone-datepicker.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./src/style/'));
});
gulp.task('css2js', function () {
return gulp.src("./src/style/onezone-datepicker.css")
.pipe(css2js())
.pipe(uglify())
.pipe(gulp.dest("./dist/"));
});
gulp.task('minify-all', ['delete-dist', 'html2js', 'sass2css', 'css2js'], function () {
return gulp.src(['./dist/*.js', './src/js/*.js'])
.pipe(concat('onezone-datepicker.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/'));
});
gulp.task('delete-dist', function () {
del(['dist/*']);
});
gulp.task('delete-trash', ['minify-all'], function () {
del(['dist/templates.js', 'dist/onezone-datepicker.js']);
});
gulp.task('default', ['delete-trash'], function () {});