forked from patternfly/patternfly-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (48 loc) · 1.51 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
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
less = require('gulp-less-sourcemap'),
plumber = require('gulp-plumber'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
path = require('path');
// Uglyfies js on to /js/minjs
gulp.task('scripts', function(){
gulp.src('js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest("js/minjs"));
});
// Compiles less on to /css
gulp.task('less', function () {
gulp.src('less/**/*.less')
.pipe(plumber())
.pipe(less({
paths: [ path.join('node_modules'), path.join('node_modules/patternfly/node_modules') ],
sourceMap: {
//sourceMapRootpath: '../less' // This one for KIE files (Optional absolute or relative path to your LESS files)
sourceMapRootpath: '/' // This one for PF files (Optional absolute or relative path to your LESS files)
}
}))
.pipe(gulp.dest('css'))
.pipe(reload({stream:true}));
});
// reload server
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: "./"
}
});
});
// Reload all Browsers
gulp.task('bs-reload', function () {
browserSync.reload();
});
// watch for changes on files
gulp.task('watch', function(){
gulp.watch('js/*.js', ['scripts']);
gulp.watch('less/*.less', ['less']);
gulp.watch("*.html", ['bs-reload']);
});
// deploys
gulp.task('default', ['scripts', 'less','browser-sync','watch']);