forked from wakatime/browser-wakatime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (57 loc) · 2.27 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
var del = require('del');
var gulp = require('gulp');
var elixir = require('laravel-elixir');
var exec = require('child_process').exec;
var fs = require('fs');
/*
|--------------------------------------------------------------------------
| Pre-defined Gulp Tasks
|--------------------------------------------------------------------------
|
| Tasks outside the scope of Elixir can be predefined before setting it up.
|
*/
gulp.task('postinstall', function (cb) {
// .pem files cause Chrome to show a bunch of warnings
//so we remove them on postinstall
del('node_modules/**/*.pem', cb);
});
gulp.task('webextension',function(cb){
if(!fs.existsSync('public/js')){
!fs.existsSync('public') && fs.mkdirSync('public');
fs.mkdirSync('public/js');
}
exec('npm install',{
cwd: 'node_modules/webextension-polyfill/'
},function(){
var stream = fs.createWriteStream('public/js/browser-polyfill.min.js');
stream.on('done',cb);
fs.createReadStream('node_modules/webextension-polyfill/dist/browser-polyfill.min.js').pipe(stream);
});
});
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Less
| file for our application, as well as publishing vendor resources.
|
*/
elixir.config.assetsPath = 'assets/';
elixir.extend('webextension', function(){
return gulp.start('webextension');
});
elixir(function (mix) {
mix.webextension();
mix.copy('vendor/bower_components/bootstrap/less', 'assets/less/bootstrap');
mix.copy('vendor/bower_components/bootstrap/fonts', 'public/fonts');
mix.copy('vendor/bower_components/font-awesome/less', 'assets/less/font-awesome');
mix.copy('vendor/bower_components/font-awesome/fonts', 'public/fonts');
mix.less('app.less');
mix.browserify('app.jsx', 'public/js/app.js', 'assets/js');
mix.browserify('events.js', 'public/js/events.js', 'assets/js');
mix.browserify('options.jsx', 'public/js/options.js', 'assets/js');
mix.browserify('devtools.js', 'public/js/devtools.js', 'assets/js');
});