-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
61 lines (52 loc) · 1.5 KB
/
gulpfile.coffee
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
gulp = require 'gulp'
$ = require('gulp-load-plugins')()
fs = require 'fs'
join = require('path').join
ChromeExtension = require 'crx'
gulp.task 'build:coffee', ->
gulp.src 'src/**/*.coffee'
.pipe $.coffee()
.pipe gulp.dest 'dist'
gulp.task 'build:sass', ->
gulp.src 'src/**/*.scss'
.pipe $.postcss([
require('precss')(import: extension: 'scss')
])
.pipe $.rename (x) -> x.extname = '.css'
.pipe gulp.dest 'dist'
gulp.task 'build:pug', ->
gulp.src 'src/**/*.jade'
.pipe $.pug()
.pipe gulp.dest 'dist'
gulp.task 'copy:manifest', ->
gulp.src 'src/manifest.json'
.pipe gulp.dest 'dist'
gulp.task 'copy:images', ->
gulp.src 'src/**/*.png'
.pipe gulp.dest 'dist'
gulp.task 'copy:libs', ->
gulp.src [
'vendor/jquery/dist/jquery.min.js'
]
.pipe gulp.dest 'dist/libs'
gulp.task 'build', gulp.parallel([
'copy:libs'
'copy:images'
'copy:manifest'
'build:coffee'
'build:sass'
'build:pug'
])
gulp.task 'serve:zip', (done) ->
crx = new ChromeExtension
privateKey: fs.readFileSync(join(__dirname, "key.pem"))
crx.load(join(__dirname,'dist'))
.then ->
crx.pack()
.then (crxBuffer) ->
fs.writeFile join(__dirname,'bin','extension.crx'), crxBuffer, (err) ->
console.log err if err
done()
gulp.task 'default', gulp.series [
'build', 'serve:zip'
]