-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
48 lines (38 loc) · 1.48 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
var gulp = require('gulp');
var merge = require('merge-stream');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var order = require('gulp-order');
var rename = require('gulp-rename');
var angularTemplates = require('gulp-angular-templates');
var palladioSources = [ "palladio-graph-view.js", "vendor/jsnetworkx/jsnetworkx.js" ];
var palladioCSS = [ "palladio-graph-view.css" ];
var palladioTemplate = [ "template.html" ];
gulp.task('scripts', gulp.series(function (done) {
var files = gulp.src(palladioSources)
.pipe(concat('jsFiles.js'));
var templates = gulp.src(palladioTemplate)
.pipe(angularTemplates({ module: 'palladio', basePath: 'partials/palladio-graph-component' }))
.pipe(rename('templates.tmpl'));
merge(files, templates)
.pipe(order(['*.js', '*.tmpl']))
.pipe(concat('palladio-graph-component.js'))
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename('palladio-graph-component.min.js'))
.pipe(gulp.dest('./dist/'));
done();
}));
gulp.task('css', gulp.series(function (done) {
gulp.src(palladioCSS)
.pipe(concat('palladio-graph-component.css'))
.pipe(gulp.dest('./dist/'));
done();
}));
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch(palladioSources).on('change', gulp.series('scripts'));
gulp.watch(palladioCSS).on('change', gulp.series('css'));
gulp.watch(palladioTemplate).on('change', gulp.series('scripts'))
});
gulp.task('default', gulp.series('scripts','css','watch'));