forked from tlemens/twitter-mass-follow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
54 lines (46 loc) · 1.35 KB
/
gulpfile.babel.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
'use strict'
const paths = {
js: ['src/javascripts/*/**.js'],
sass: ['src/stylesheets/extension.scss']
}
import autoprefixer from 'autoprefixer'
import browserify from 'browserify'
import buffer from 'vinyl-buffer'
import babelify from 'babelify'
import gulp from 'gulp'
import nano from 'gulp-cssnano'
import postcss from 'gulp-postcss'
import sass from 'gulp-sass'
import source from 'vinyl-source-stream'
import uglify from 'gulp-uglify'
gulp.task('sass', () => {
const processors = [autoprefixer({ browsers: ['last 2 versions'] })]
return gulp.src(paths.sass)
.pipe(sass().on('error', sass.logError))
.pipe(postcss(processors))
.pipe(nano({ zindex: false }))
.pipe(gulp.dest('extension'))
})
gulp.task('js', () => {
browserify({ debug: true })
.transform(babelify)
.require("./src/javascripts/extension.js", { entry: true })
.bundle()
.pipe(source('extension.js'))
.pipe(gulp.dest('extension'))
})
gulp.task('production', () => {
browserify()
.transform(babelify)
.require("./src/javascripts/extension.js", { entry: true })
.bundle()
.pipe(source('extension.js'))
.pipe(buffer())
.pipe(uglify({ compress: { drop_console: true }}))
.pipe(gulp.dest('extension'))
})
gulp.task('watch', () => {
gulp.watch(paths.js, ['js'])
gulp.watch(paths.sass, ['sass'])
})
gulp.task('default', ['watch'])