-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (50 loc) · 1.41 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
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const minify = require('gulp-minify');
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
// sass file watcher
gulp.task('sass:watch', () => {
gulp.watch('./assets/scss/*.scss', ['sass']);
});
// preprocess scss to css
gulp.task('sass', () => {
return gulp.src('./assets/scss/style.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
// post-process css with prefixes
.pipe(autoprefixer({
browsers: ['last 5 versions'],
cascade: false
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./assets/css/'));
});
// concatenate js
gulp.task('js:concat', () => {
return gulp.src(['./public/ammo.js', './public/app.js'])
.pipe(sourcemaps.init())
.pipe(babel({
presets: ["es2015"]
}))
.pipe(concat('main.js', {
newLine: '\n;'
}))
.pipe(gulp.dest('./public/'));
});
// minify js
gulp.task('js:minify', () => {
gulp.src('./dist/ammo.js')
.pipe(minify({
ext: {
src: '.js',
min: '.min.js'
}
}))
.pipe(gulp.dest('./dist/'));
});