Some comments for better understanding

This commit is contained in:
atomtigerzoo 2017-08-10 16:22:31 +02:00
parent 4f7c68fd3b
commit 6f52084d7b
1 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ gulp.task("hugo-preview", (cb) => buildSite(cb, hugoArgsPreview));
gulp.task("build", ["css", "js"], (cb) => buildSite(cb, [], "production"));
gulp.task("build-preview", ["css", "js"], (cb) => buildSite(cb, hugoArgsPreview, "production"));
// Compile CSS with PostCSS
gulp.task("css", () => (
gulp.src("./src/css/*.css")
.pipe(postcss([cssImport({from: "./src/css/main.css"}), cssnext()]))
@ -30,6 +31,7 @@ gulp.task("css", () => (
.pipe(browserSync.stream())
));
// Compile Javascript
gulp.task("js", (cb) => {
const myConfig = Object.assign({}, webpackConfig);
@ -44,6 +46,7 @@ gulp.task("js", (cb) => {
});
});
// Development server with browsersync
gulp.task("server", ["hugo", "css", "js"], () => {
browserSync.init({
server: {
@ -55,6 +58,9 @@ gulp.task("server", ["hugo", "css", "js"], () => {
gulp.watch("./site/**/*", ["hugo"]);
});
/**
* Run hugo and build the site
*/
function buildSite(cb, options, environment = "development") {
const args = options ? hugoArgsDefault.concat(options) : hugoArgsDefault;