2020-02-20 14:38:25 -08:00
|
|
|
|
|
|
|
const { series, parallel, watch } = require('gulp');
|
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
2020-02-21 20:05:52 -08:00
|
|
|
var content = require('./content');
|
|
|
|
exports.parse = content.parse;
|
|
|
|
exports.pages = content.write;
|
|
|
|
exports.content = series(content.parse, content.write);
|
2020-02-20 14:38:25 -08:00
|
|
|
|
|
|
|
var images = require('./imgflow');
|
|
|
|
exports.twimages = images.twitter;
|
|
|
|
exports.images = images;
|
|
|
|
exports['images-prod'] = images.prod;
|
|
|
|
exports['twimages-prod'] = images.twitter.prod;
|
|
|
|
exports.favicon = images.favicon;
|
|
|
|
|
|
|
|
const filesTask = require('./files');
|
|
|
|
exports.files = filesTask;
|
|
|
|
exports['files-prod'] = filesTask.prod;
|
|
|
|
|
|
|
|
var scssTask = require('./scss');
|
|
|
|
exports.scss = scssTask;
|
|
|
|
|
|
|
|
var jsTask = require('./scripts');
|
|
|
|
exports.js = jsTask;
|
|
|
|
|
|
|
|
var cleanTask = require('./clean');
|
|
|
|
exports.clean = cleanTask;
|
|
|
|
|
|
|
|
const pushToProd = require('./publish');
|
|
|
|
exports.push = pushToProd;
|
|
|
|
|
|
|
|
const cloudfront = require('./cloudfront');
|
|
|
|
exports.cloudfront = cloudfront;
|
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
2020-02-21 20:05:52 -08:00
|
|
|
var prodBuildTask = series(
|
2020-02-20 14:38:25 -08:00
|
|
|
images.prod,
|
|
|
|
images.favicon.prod,
|
|
|
|
scssTask.prod,
|
|
|
|
jsTask.prod,
|
|
|
|
filesTask.prod,
|
2020-02-21 20:05:52 -08:00
|
|
|
content.parse,
|
2020-02-20 14:38:25 -08:00
|
|
|
images.twitter.prod,
|
2020-02-21 20:05:52 -08:00
|
|
|
content.write.prod,
|
2020-02-20 14:38:25 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
var devBuildTask = series(
|
|
|
|
parallel(
|
|
|
|
images,
|
|
|
|
images.favicon,
|
|
|
|
scssTask,
|
|
|
|
jsTask,
|
|
|
|
filesTask,
|
2020-02-21 20:05:52 -08:00
|
|
|
content.parse,
|
2020-02-20 14:38:25 -08:00
|
|
|
),
|
2020-02-21 20:05:52 -08:00
|
|
|
content.write,
|
2020-02-20 14:38:25 -08:00
|
|
|
images.twitter,
|
|
|
|
);
|
|
|
|
|
|
|
|
exports.dev = devBuildTask;
|
2020-02-21 20:05:52 -08:00
|
|
|
exports.prod = prodBuildTask;
|
2020-02-20 14:38:25 -08:00
|
|
|
exports.publish = series(
|
|
|
|
cleanTask,
|
2020-02-21 20:05:52 -08:00
|
|
|
prodBuildTask,
|
2020-02-20 14:38:25 -08:00
|
|
|
pushToProd,
|
|
|
|
cloudfront.prod,
|
|
|
|
);
|
|
|
|
exports.testpush = pushToProd.dryrun;
|
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
|
|
|
function watcher () {
|
|
|
|
|
|
|
|
watch([
|
|
|
|
'pages/**/*.{md,hbs,html}',
|
|
|
|
'templates/*.{md,hbs,html}',
|
2020-02-21 20:05:52 -08:00
|
|
|
], series(content.parse, images.twitter, content.write));
|
2020-02-20 14:38:25 -08:00
|
|
|
|
|
|
|
watch('page/**/*.{jpeg,jpg,png,gif}', images);
|
|
|
|
|
|
|
|
watch('scss/*.scss', scssTask);
|
|
|
|
watch('js/*.js', jsTask);
|
|
|
|
|
|
|
|
var forever = require('forever');
|
|
|
|
var srv = new forever.Monitor('server.js');
|
|
|
|
srv.start();
|
|
|
|
forever.startServer(srv);
|
|
|
|
}
|
|
|
|
|
|
|
|
function server () {
|
|
|
|
|
|
|
|
var forever = require('forever');
|
|
|
|
var srv = new forever.Monitor('server.js');
|
|
|
|
srv.start();
|
|
|
|
forever.startServer(srv);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:05:52 -08:00
|
|
|
exports.watch = series(series(content.parse, images.twitter, content.write), watcher);
|
|
|
|
exports.uat = series(cleanTask, prodBuildTask, server);
|
2020-02-20 14:38:25 -08:00
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
|
|
|
exports.default = series(cleanTask.dev, devBuildTask, watcher);
|