-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (46 loc) · 1.45 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
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
babel = require('gulp-babel'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass');
var paths = {
scripts: [
'js/utils.js',
'js/main.js'
],
injectedScripts: [
'js/utils.js',
'js/injected.js'
],
styles: [
'css/main.scss'
]
};
gulp.task('default');
gulp.task('compile-styles', function() {
return gulp.src(paths.styles)
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('css'));
});
gulp.task('compile-scripts', function() {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(babel({ presets: ['es2015'] }))
.pipe(uglify().on('error', function(err){throw err;}))
.pipe(concat('js/main.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./'));
});
gulp.task('compile-injected', function() {
return gulp.src(paths.injectedScripts)
.pipe(sourcemaps.init())
.pipe(babel({ presets: ['es2015'] }))
.pipe(uglify().on('error', function(err){throw err;}))
.pipe(concat('js/injected.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./'));
});
gulp.task('build', ['compile-styles', 'compile-scripts', 'compile-injected']);