forked from NikolayRys/Likely
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
58 lines (48 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
// "autoprefixer-core": "^4.0.0",
// "gulp-postcss": "^3.0.0",
// "gulp-sass": "^1.1.0",
// "postcss-assets": "^0.9.0"
var gulp = require ('gulp')
var browserify = require ('gulp-browserify')
var uglify = require ('gulp-uglify')
var insert = require ('gulp-insert')
var stylus = require ('gulp-stylus')
var csso = require ('gulp-csso')
var zip = require ('gulp-zip')
var release = './release/'
function comment (version) {
return require ('fs').readFileSync ('./source/header.js')
.toString ()
.replace (/\$version/g, version)
}
gulp.task ('js', function () {
var version = require ('./package.json').version
return gulp.src ('./source/likely.js')
.pipe (browserify ())
.pipe (uglify ())
.pipe (insert.prepend (comment (version)))
.pipe (gulp.dest (release))
})
gulp.task ('css', function () {
return gulp.src ('./styles/likely.styl')
.pipe (stylus ())
.pipe (csso ())
.pipe (gulp.dest (release))
})
gulp.task ('zip', ['js', 'css'], function () {
var version = require ('./package.json').version
return gulp.src ([
release + 'license.txt',
release + 'likely.css',
release + 'likely.js',
])
.pipe (zip ('ilya-birman-likely-' + version + '.zip'))
.pipe (gulp.dest (release))
})
gulp.task ('build', ['js', 'css'])
gulp.task ('default', ['js', 'css', 'zip'], function () {
gulp.watch ('source/*.js', ['zip'])
gulp.watch ('source/services/*.js', ['zip'])
gulp.watch ('styles/*.styl', ['zip'])
gulp.watch ('license.txt', ['zip'])
})