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