forked from wilzbach/msa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (54 loc) · 1.8 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 path = require('path');
var mkdirp = require('mkdirp-then');
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var concat = require('gulp-concat');
var chmod = require('gulp-chmod');
var rename = require('gulp-rename');
var minifyCSS = require('gulp-minify-css');
var gzip = require('gulp-gzip');
var buildDir = "dist";
gulp.task('default', ['build']);
gulp.task('build', ['min-css', 'build-gzip']);
// test are currently not run
//gulp.task('test', ['test-mocha']);
//gulp.task('test-mocha', function () {
// return gulp.src('./test/mocha/**/*.js', {read: false})
// .pipe(mocha({reporter: 'spec',
// ui: "qunit",
// useColors: false
// }));
//});
//
//gulp.task('watch-mocha', ['test-mocha'], function() {
// gulp.watch(['./src/**/*.js', './test/**/*.js'], ['test-mocha']);
//});
gulp.task('css',['init'], function () {
return gulp.src(path.join('css', '*.css') )
.pipe(concat('msa.css'))
.pipe(chmod(644))
.pipe(gulp.dest(buildDir));
});
gulp.task('build-gzip', ['build-gzip-js', 'build-gzip-css']);
gulp.task('build-gzip-js', function() {
return gulp.src(path.join(buildDir, "msa.js"))
.pipe(gzip({append: false, gzipOptions: { level: 9 }}))
.pipe(rename("msa.min.gz.js"))
.pipe(gulp.dest(buildDir));
});
gulp.task('build-gzip-css', ['min-css'], function() {
return gulp.src(path.join(buildDir, "msa.min.css"))
.pipe(gzip({append: false, gzipOptions: { level: 9 }}))
.pipe(rename("msa.min.gz.css"))
.pipe(gulp.dest(buildDir));
});
gulp.task('min-css',['css'], function () {
return gulp.src(path.join(buildDir,"msa.css"))
.pipe(minifyCSS())
.pipe(rename('msa.min.css'))
.pipe(chmod(644))
.pipe(gulp.dest(buildDir));
});
gulp.task('init', function() {
return mkdirp(buildDir)
});