Commit abed8d12 authored by cgm616's avatar cgm616

Add separate build pipelines

parent f270bd3d
build: node_modules
node index.js
serve: build
node index.js serve
node_modules: package.json
npm install
......
var Metalsmith = require('metalsmith');
var msIf = require('metalsmith-if');
var markdown = require('metalsmith-markdown');
var layouts = require('metalsmith-layouts');
var permalinks = require('metalsmith-permalinks');
......@@ -22,6 +23,14 @@ var dates = require('metalsmith-date-formatter');
var fs = require('fs')
var path = require('path')
var shouldServe = false;
process.argv.forEach(function(arg) {
if(arg === "serve") {
shouldServe = true;
}
});
Metalsmith(__dirname) // instantiate Metalsmith in the cwd
.metadata({
title: "cgm616",
......@@ -32,13 +41,15 @@ Metalsmith(__dirname) // instantiate Metalsmith in the cwd
})
.source('./src') // specify source directory
.destination('./build') // specify destination directory
.use(watch({
.use(msIf(
shouldServe,
watch({
paths: {
"**/*.*": "**/*",
},
})
)
.use(serve())
))
.use(msIf(shouldServe, serve()))
.use(drafts())
.use(collections({
articles: 'articles/*.md'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment