-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
44 lines (39 loc) · 1.21 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
"use strict";
var gulp = require('gulp');
gulp.task('default', ['stylus', 'browserify', 'nano']);
gulp.task('stylus', function() {
return gulp.src('public/css/index.styl')
.pipe(require('gulp-stylus')({
compile: function(str, path) {
return require('stylus')(str)
.set('filename', path)
.set('compress', true)
.set('include css', true)
.use(require('nib')())
.import('nib');
}
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('browserify', function() {
gulp.src('src/client/index.js', { read: false })
.pipe(require('gulp-browserify')())
.pipe(gulp.dest('./public/js'));
});
gulp.task('nano', function() {
var map = require('map-stream')
, path = require('path');
var render = function(file, cb) {
var Nano = require('nanotemplates')
, nano = new Nano({ basedir: 'views' });
var relPath = path.relative('views', file.path);
nano.render(relPath, { baseUrl: '/keynote-browserify/public' }, function(err, html) {
if (err) return cb(err);
file.contents = new Buffer(html, 'utf-8');
cb(null, file);
});
};
gulp.src('views/*.html')
.pipe(map(render))
.pipe(gulp.dest('.'));
});