-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
58 lines (51 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
57
58
// Gulp
const gulp = require('gulp');
// Debug plugins
const plumber = require("gulp-plumber");
// Other plugins
const concat = require('gulp-concat');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const cssnano = require('gulp-cssnano');
const uglify = require('gulp-uglify');
const babel = require('gulp-babel');
const gzip = require('gulp-gzip');
// Paths
const vendor = 'node_modules/';
const source = 'assets/';
const dest = 'public/';
// Prod
gulp.task('default', ['css', 'js']);
// Watch (dev)
gulp.task('watch', function () {
gulp.watch(source + 'css/**/*.scss', ['css']);
gulp.watch(source + 'js/**/*.js', ['js']);
});
// CSS
gulp.task('css', function() {
return gulp.src([
source + 'css/main.scss'
])
.pipe(plumber())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions', '> 1%', 'Explorer 7', 'Android >= 2', 'Safari > 3'],
}))
.pipe(cssnano())
.pipe(concat('app.css'))
.pipe(gulp.dest(dest));
});
// JS
gulp.task('js', function() {
return gulp.src([
vendor + 'paper/dist/paper-full.js',
source + 'js/background.js',
source + 'js/main.js'
])
.pipe(plumber())
.pipe(concat('app.js'))
.pipe(uglify({
mangle: false
}))
.pipe(gulp.dest(dest));
});