This repository has been archived by the owner on May 12, 2019. It is now read-only.
forked from netzmacht-archive/contao-theme-plus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
66 lines (60 loc) · 1.77 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'),
// gulp modules
autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
uglifyJs = require('gulp-uglify'),
wait = require('gulp-wait'),
// native modules
del = require('del'),
runSequence = require('run-sequence');
/**
* Build stylesheets tasks
*/
gulp.task('build-stylesheets', function () {
return gulp.src('assets/sources/stylesheets/*.scss')
.pipe(wait(500))
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write('.', { sourceRoot: '../sources/stylesheets' }))
.pipe(gulp.dest('assets/stylesheets'));
});
/**
* Build javascripts tasks
*/
gulp.task('build-javascripts', function () {
return gulp.src('assets/sources/javascripts/*.js')
.pipe(wait(500))
.pipe(plumber())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglifyJs())
.pipe(sourcemaps.write('.', { sourceRoot: '../sources/javascripts' }))
.pipe(gulp.dest('assets/javascripts'));
});
/**
* Global build tasks
*/
gulp.task('clean', function (cb) {
del(['assets/stylesheets', 'assets/javascripts'], cb);
});
gulp.task('build', function() {
runSequence(
'clean',
['build-stylesheets', 'build-javascripts']
);
});
gulp.task('watch', function () {
gulp.watch('assets/sources/stylesheets/*.scss', ['build-stylesheets']);
gulp.watch('assets/sources/javascripts/*.js', ['build-javascripts']);
});
gulp.task('default', function() {
runSequence('build', 'watch');
});