-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
71 lines (65 loc) · 1.88 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
69
70
71
var gulp = require('gulp'),
sass = require('gulp-sass'),
sassGlob = require('gulp-sass-glob'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify'),
plumber = require('gulp-plumber'),
cssshrink = require('gulp-cssshrink'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload');
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer');
var paths = {
styles: {
src: 'sass/',
files: 'sass/**/*.scss',
dest: 'public/css'
}
};
gulp.task('sass', () => {
gulp.src(paths.styles.files)
.pipe(plumber({
errorHandler: notify.onError("Sass Error: <%= error.message %>")}
))
.pipe(sassGlob())
.pipe(sass({
outputStyle: 'compressed',
sourceComments: false,
includePaths: [paths.styles.src],
errLogToConsole: true
}))
.pipe(gulp.dest(paths.styles.dest))
.pipe(livereload());
});
gulp.task('concat', () => {
return gulp.src([
'scripts/libs/es5-shim.min.js',
'scripts/libs/es5-sham.min.js',
'scripts/libs/warn-polyfill.js',
'scripts/libs/event-polyfill.js',
'scripts/libs/console-polyfill.js'
])
.pipe(concat('ie8.js'))
.pipe(gulp.dest('public/scripts'));
});
gulp.task('js', () => {
return browserify()
.transform("babelify", {
presets: ["latest", "react"]
})
.add('scripts/src/app.js')
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
// .pipe(uglify())
.pipe(gulp.dest("public/scripts"))
.pipe(livereload());
});
gulp.task('watch', () => {
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch('scripts/src/**/*.*', ['js']);
livereload.listen();
});
gulp.task('release', ['concat', 'sass', 'js']);
gulp.task('default', ['watch', 'concat', 'sass', 'js']);