-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
51 lines (46 loc) · 1.04 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
'use strict';
/**
* Dependencies.
*/
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var npmcss = require('npm-css');
var CleanCSS = require('clean-css');
/**
* Create build directory
*/
mkdirp('./build');
/**
* Browserify task
*/
gulp.task('browserify', function() {
var file = path.resolve('index.js');
browserify(file)
.require(file, {'expose': 'modal'})
.transform({'global': true}, 'jadeify')
.transform({'global': true}, 'uglifyify')
.bundle({
'debug': false
})
.pipe(source('build.js'))
.pipe(gulp.dest('./build/'));
});
/**
* npmcss task
*/
gulp.task('npmcss', function() {
var file = path.resolve('index.css');
var output = fs.createWriteStream('build/build.css');
var linked = npmcss(file);
var minified = new CleanCSS().minify(linked);
output.write(minified);
output.end();
});
/**
* Build task
*/
gulp.task('build', ['browserify', 'npmcss']);