-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (64 loc) · 1.69 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
67
68
69
70
71
72
73
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
livereload = require('gulp-refresh'),
browserify = require('browserify'),
buffer = require('vinyl-buffer'),
source = require('vinyl-source-stream'),
uglify = require('gulp-uglify');
var sass_paths = '_src/sass/**/**.scss',
css_path = 'umbraco/assets/css',
js_src_path = '_src/js/main.js',
js_vendor_src_path = '_src/js/vendor.js',
js_path = 'umbraco/assets/js';
var sass_options = {
errLogToConsole: true,
outputStyle: 'expanded'
};
var on_error = function (error)
{
gutil.log(gutil.colors.red(error));
this.emit('end');
};
gulp.task('reload', () => {
livereload.reload()
})
gulp.task('sass', function () {
return gulp
.src(sass_paths)
.pipe(sass(sass_options)
.on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest(css_path))
.pipe(livereload());
});
gulp.task('js', function()
{
return browserify(js_src_path)
.bundle()
.pipe(source('main.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(js_path))
.pipe(livereload());
});
gulp.task('js-vendor', function()
{
return browserify(js_vendor_src_path)
.bundle()
.pipe(source('vendor.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(js_path))
.pipe(livereload());
});
gulp.task('watch', function()
{
livereload.listen();
gulp.watch([js_src_path, '_src/js/scripts/**/*.js'], ['js']);
gulp.watch([js_vendor_src_path, '_src/js/vendor/**/*.js'], ['js-vendor']);
gulp.watch(sass_paths, ['sass']);
gulp.watch('**/*.cshtml', ['reload']);
});
gulp.task('default', ['watch', 'reload']);