citra-emu
/
citra-web
Archived
1
0
Fork 0

Added live-reloading to gulp / hugo.

This commit is contained in:
chris062689 2017-06-24 22:14:34 -04:00
parent 2c6d226a22
commit 97162d0dd7
2 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ site/hugo
site/hugo.exe site/hugo.exe
# Hugo generated static website files. # Hugo generated static website files.
public/
site/public/ site/public/
.publish/ .publish/

View File

@ -17,14 +17,15 @@ const imageResize = require('gulp-image-resize');
const htmlmin = require('gulp-htmlmin'); const htmlmin = require('gulp-htmlmin');
const distPath = './site/public'; const hugoPath = './site';
const distPath = './public';
const cname = 'citra-emu.org'; const cname = 'citra-emu.org';
const deployOptions = { const deployOptions = {
remoteUrl: "git@github.com:CitraBotWeb/CitraBotWeb.github.io.git", remoteUrl: "git@github.com:CitraBotWeb/CitraBotWeb.github.io.git",
branch: "master" branch: "master"
}; };
gulp.task("default", ['serve']); gulp.task("default", ['setup', 'serve']);
// PHASE 1 - Setup // PHASE 1 - Setup
gulp.task('setup', function(cb) { gulp.task('setup', function(cb) {
@ -44,8 +45,8 @@ gulp.task('setup', function(cb) {
// PHASE 2 - Data Dependencies // PHASE 2 - Data Dependencies
// PHASE 3 - Building // PHASE 3 - Building
gulp.task('hugo', ['setup'], function (cb) { gulp.task('hugo', function (cb) {
exec('hugo -s ./site/ -v', function (err, stdout, stderr) { exec('hugo -s ./site/ -d ../public/ -v', function (err, stdout, stderr) {
console.log(stdout); console.log(stdout);
console.log(stderr); console.log(stderr);
cb(err); cb(err);
@ -80,7 +81,10 @@ gulp.task('images', ['hugo'], () => (
)); ));
// This task ensures all phases up to PHASE 3 are completed. // This task ensures all phases up to PHASE 3 are completed.
gulp.task('build', ['hugo', 'css', 'images']); gulp.task('build', ['hugo', 'css', 'images'], function (done) {
browsersync.reload();
done();
});
// STAGE 4 - Optimization // STAGE 4 - Optimization
gulp.task('compress', ['build'], () => ( gulp.task('compress', ['build'], () => (
@ -107,10 +111,12 @@ gulp.task('serve', ['build'], () => {
}, },
open: false open: false
}); });
gulp.watch('./site/**/*', ['build']);
}); });
// Used for Production // Used for Production
gulp.task('deploy', ['build', 'compress'], () => { gulp.task('deploy', ['setup', 'build', 'compress'], () => {
require('fs').writeFileSync(`${distPath}/CNAME`, `${cname}`); require('fs').writeFileSync(`${distPath}/CNAME`, `${cname}`);
require('fs').writeFileSync(`${distPath}/robots.txt`, `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`); require('fs').writeFileSync(`${distPath}/robots.txt`, `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`);
return gulp.src(`${distPath}/**/*`).pipe(ghPages(deployOptions)); return gulp.src(`${distPath}/**/*`).pipe(ghPages(deployOptions));