-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
66 lines (60 loc) · 1.86 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
var gulp = require('gulp');
var cache = require('gulp-cached');
var plumber = require('gulp-plumber');
var babel = require('gulp-babel');
var rename = require('gulp-rename');
var ngAnnotate = require('gulp-ng-annotate');
var vinylPaths = require('vinyl-paths');
var del = require('del');
var changed = require('gulp-changed');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var less = require('gulp-less');
var lessPluginCleanCSS = require('less-plugin-clean-css');
var cleancss = new lessPluginCleanCSS({advanced: true});
var htmlMin = require('gulp-minify-html');
var uglify = require('gulp-uglify');
var KarmaServer = require('karma').Server;
var path = {
src: 'src/**/*.js',
output: 'dist/',
test: 'test/'
};
var compilerOptions = {
modules: 'umd',
// moduleIds: false,
// externalHelpers: true,
comments: true,
compact: false,
};
gulp.task('clean', function() {
return gulp.src([path.output])
.pipe(vinylPaths(del));
});
gulp.task('compile', ['clean'], function(){
return gulp.src(path.src)
.pipe(cache('es6'))
.pipe(plumber())
.pipe(changed(path.output, { extension: '.js' }))
.pipe(sourcemaps.init())
.pipe(babel(compilerOptions))
.pipe(ngAnnotate({
sourceMap: true,
gulpWarnings: false
}))
.pipe(concat('angular-translate-loader-pluggable.js'))
.pipe(gulp.dest(path.output))
.pipe(uglify())
// .pipe(concat('angular-translate-loader-pluggable.min.js'))
.pipe(rename({ extname: '.min.js'}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(path.output));
});
gulp.task('test', ['compile'], function (done) {
new KarmaServer({
configFile: __dirname + '/' + path.test + 'conf/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('build', ['compile']);
gulp.task('default', []);