forked from SouthAmericansSecrets/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (34 loc) · 1.02 KB
/
gulpfile.js
File metadata and controls
38 lines (34 loc) · 1.02 KB
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
/*
Guplfile is only for compile templates in production
*/
var nunjucksRender = require('gulp-nunjucks-render');
var gulp = require('gulp');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
var ghpages = require('gh-pages');
var path = require('path');
var gutil = require('gulp-util');
gulp.task('nunjucks', function() {
return gulp.src('app/tpl/pages/**/*.+(html|njk)')
.pipe(nunjucksRender({
path: ['app/tpl/layouts','app/tpl/partials']
}))
.pipe(gulp.dest('build'));
});
gulp.task("webpack", function(callback) {
webpack(webpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
callback();
});
});
gulp.task("build",["nunjucks","webpack"], function(callback) {
callback();
});
gulp.task("publish",["build"], function(callback) {
ghpages.publish(path.join(__dirname, 'build'),
{
branch: 'gh-pages',
repo: 'https://github.com/SouthAmericansSecrets/web.git'
},
function(err) { console.log("published in gh-pages");});
});