-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathgulpfile.js
67 lines (56 loc) · 1.53 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
'use strict';
const stream = require('stream');
const gulp = require('gulp');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const postcss = require('gulp-postcss');
const inlineImport = require('postcss-import');
const inlineUrl = require('postcss-url');
const autoprefixer = require('autoprefixer');
const production = process.env.NODE_ENV === 'production';
const postcssPlugins = [
inlineImport(),
autoprefixer({ browsers: '> 5%'}),
inlineUrl({ url: 'inline' })
];
const outChrome = './dist/chrome';
const coreFiles = [
'lib/underscore.js',
'lib/js-signals.js',
'signals.js',
'utils.js',
'dom.js',
'settings.js',
'renderer.js',
'search.js',
'search_ui.js',
'dnd.js',
'outline.js',
'outline_ui.js',
'controller.js',
'selection-notifier.js',
'clipboard.js'
];
gulp.task('chrome', ['chrome:js', 'chrome:css', 'chrome:assets']);
gulp.task('chrome:js', () => {
return gulp.src(coreFiles, { cwd: './src' })
.pipe(concat('xv.js'))
.pipe(production ? uglify() : pass())
.pipe(gulp.dest(outChrome));
});
gulp.task('chrome:css', () => {
return gulp.src('./css/xv.css')
.pipe(postcss(postcssPlugins))
.pipe(gulp.dest(outChrome));
});
gulp.task('chrome:assets', () => {
return gulp.src(['./extensions/chrome/**', './src/dnd_feedback.js'])
.pipe(gulp.dest(outChrome));
});
gulp.task('watch', ['chrome'], () => {
gulp.watch(['./src/**', './css/**', './extensions/chrome/**'], ['chrome']);
});
gulp.task('default', ['chrome']);
function pass() {
return new stream.PassThrough({ objectMode: true });
}