-
Notifications
You must be signed in to change notification settings - Fork 52
/
gulpfile.js
68 lines (55 loc) · 1.49 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var uglify = require('gulp-uglify');
var autoprefixer = require('gulp-autoprefixer');
var exec = require('gulp-exec');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var BASE = './src/';
var scripts = {
base: BASE,
colorify: {
a: BASE + 'init.js',
b: BASE + 'base.js',
c: BASE + 'colorify.js'
},
ui: {
a: BASE + 'prism.js',
b: BASE + 'ui.js'
}
}
gulp.task('default', ['serve', 'watch', 'sass', 'bundle:colorify'], function(){});
gulp.task('serve', function(){
gulp.src('./**/**')
.pipe(exec('npm run serve'));
});
gulp.task('bundle:colorify', ['bundle:ui'], function(){
gulp.src([scripts.colorify.c])
.pipe(concat('colorify.js'))
// .pipe(uglify())
.pipe(gulp.dest('./scripts'));
})
gulp.task('bundle:minify', function(){
gulp.src('./scripts/colorify.js')
.pipe(uglify())
.pipe(rename("colorify.min.js"))
.pipe(gulp.dest('./scripts'));
})
gulp.task('bundle:ui', function(){
gulp.src([scripts.ui.a,scripts.ui.b])
.pipe(concat('app.js'))
.pipe(gulp.dest('./scripts'));
})
gulp.task('sass', function () {
return sass('./styles/**/*.scss')
.on('error', sass.logError)
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(gulp.dest('./styles'));
});
gulp.task('watch', function () {
gulp.watch('./styles/**/*.scss', ['sass']);
gulp.watch('./src/**/*.js', ['bundle:colorify']);
});