-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathgulpfile.js
36 lines (33 loc) · 974 Bytes
/
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
var gulp = require('gulp')
var webpack = require('webpack')
var fs = require('fs')
var path = require('path')
gulp.task('demo', ['build'], function() {
var demo = require('./dist/demo')
var html = ('<!doctype html>'
+ '<head>'
+ '<meta name="viewport" content="width=device-width" />'
+ '<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:600,300" />'
+ '<link rel="stylesheet" href="assets/css/demo.css" />'
+ '</head>'
+ '<body>'
+ '<div id="container">'
+ demo.render()
+ '</div>'
+ '<script src="./dist/demo.js"></script>'
+ '<script>__DEMO__.run()</script>'
+ '</body>'
+ '</html>'
)
fs.writeFileSync(path.resolve('index.html'), html)
})
gulp.task('build', function(done) {
var compiler = webpack(require('./webpack.config.js'))
compiler.run(function(err, stats) {
if (err) {
return console.log(err)
}
console.log(stats.toString())
done()
})
})