diff --git a/build.js b/build.js index 519f899..65cf2ac 100644 --- a/build.js +++ b/build.js @@ -7,28 +7,28 @@ var pkg = require('./package.json'); // main directories dir = { - base: __dirname + '/', - lib: __dirname + '/lib/', - source: './src/', - dest: './build/' + base: __dirname + '/', + lib: __dirname + '/lib/', + source: './src/', + dest: './build/' }; siteMeta = { - devBuild: devBuild, - version: pkg.version, - name: 'dashdevs-suite', - desc: 'dashdevs-suite metalsmith website', - author: 'dashdevs', - contact: 'https://chat.dashdevs.org', - domain: devBuild ? 'http://127.0.0.1' : 'https://dashdev-suite.github.io', // set domain - rootpath: devBuild ? null : '/dashdev-website/build/' // set absolute path (null for relative) + devBuild: devBuild, + version: pkg.version, + name: 'dashdevs-suite', + desc: 'dashdevs-suite metalsmith website', + author: 'dashdevs', + contact: 'https://chat.dashdevs.org', + domain: devBuild ? 'http://127.0.0.1' : 'https://dashdev-suite.github.io', // set domain + rootpath: devBuild ? null : '/dashdev-website/build/' // set absolute path (null for relative) }; templateConfig = { - engine: 'handlebars', - directory: 'template/', - partials: 'partials/', - default: 'page.html' + engine: 'handlebars', + directory: 'template/', + partials: 'partials/', + default: 'page.html' }; // metalsmith @@ -62,103 +62,115 @@ console.log((devBuild ? 'Development' : 'Production'), 'build, version', pkg.ver // instantiate var metalsmith = Metalsmith(__dirname) - .clean(true) // clean folder before a production build - .source(dir.source + 'html/') // source folder (src/) - .destination(dir.dest) // build folder (build/) - .metadata(siteMeta) // add meta data to every page - .use(publish()) // draft, private, future-dated - .use(discoverPartials({ // needed for markdownPrecompiler - directory: 'partials', - pattern: /\.hbs$/ // original partials .html but exactly these parameters work - })) - // .use(json_to_files({ - // source_path: './box/' - // })) - .use(paths()) - .use(setdate()) // set date on every page if not set in front-matter - .use(collections({ // determine page collection/taxonomy - page: { - pattern: '**/index.*', - sortBy: 'priority', - reverse: true, - refer: false - }, - start: { - pattern: 'start/**/*', - sortBy: 'priority', - reverse: true, - refer: true, - metadata: { - layout: './../src/layouts/article.hbs' // default is /layouts - } - }, - article: { - pattern: 'article/**/*', - sortBy: 'date', - reverse: true, - refer: true, - limit: 50, - metadata: { - layout: './../src/layouts/article.hbs' - } - } - })) - .use(markdownPrecompiler({ // convert {{> navmain}} in header.html - engine: "handlebars", - pattern: /\.md$/, // regex; no idea why .md works, check discoverPartials above - partialsPath: './../partials', - partials: ['navmain', 'navsub', 'footer', 'header', 'meta', 'pagelist'] - })) - .use(markdown()) // convert markdown - .use(permalinks({ // generate permalinks - pattern: ':mainCollection/:title' - })) - .use(wordcount({ // word count - raw: true - })) - .use(moremeta()) // determine root paths and navigation, TODO check remove - // .use(inplace({ - // //engineOptions: {}, - // pattern: `partials.hbs/**` - // })) - .use(layouts({ - //engineOptions: {}, - pattern: `**/index.*`, - default: './../src/layouts/page.hbs' - })) -// .use(layouts({ -// //engineOptions: {}, -// pattern: `article/**`, -// default: 'article.hbs' -// })) + .clean(true) // clean folder before a production build + .source(dir.source + 'html/') // source folder (src/) + .destination(dir.dest) // build folder (build/) + .metadata(siteMeta) // add meta data to every page + .use(publish()) // draft, private, future-dated + .use(discoverPartials({ // needed for markdownPrecompiler + directory: 'partials', + pattern: /\.hbs$/ // original partials .html but exactly these parameters work + })) + // .use(json_to_files({ + // source_path: './box/' + // })) + .use(paths()) + .use(setdate()) // set date on every page if not set in front-matter + .use(collections({ // determine page collection/taxonomy + page: { + pattern: '**/index.*', + sortBy: 'priority', + reverse: true, + refer: false + }, + docs: { + pattern: 'docs/**/*', + sortBy: 'priority', + reverse: true, + refer: true, + metadata: { + layout: './../src/layouts/article.hbs' // default is /layouts + } + }, + article: { + pattern: 'article/**/*', + sortBy: 'date', + reverse: true, + refer: true, + limit: 50, + metadata: { + layout: './../src/layouts/article.hbs' + } + }, + tutorials: { + pattern: 'tutorials/**/*', + sortBy: 'priority', + reverse: true, + refer: true, + limit: 50, + }, + boxes: { + pattern: 'boxes/**/*', + sortBy: 'date', + reverse: true, + refer: true, + limit: 50, + } + })) + .use(markdownPrecompiler({ // convert {{> navmain}} in header.html + engine: "handlebars", + pattern: /\.md$/, // regex; no idea why .md works, check discoverPartials above + partialsPath: './../partials', + partials: ['navmain', 'navsub', 'footer', 'header', 'meta', 'pagelist'] + })) + .use(markdown()) // convert markdown + .use(permalinks({ // generate permalinks + pattern: ':mainCollection/:title' + })) + .use(wordcount({ // word count + raw: true + })) + .use(moremeta()) // determine root paths and navigation, TODO check remove + // .use(inplace({ + // //engineOptions: {}, + // pattern: `partials.hbs/**` + // })) + .use(layouts({ + //engineOptions: {}, + pattern: `**/index.*`, + default: './../src/layouts/page.hbs' + })) + // .use(layouts({ + // //engineOptions: {}, + // pattern: `article/**`, + // default: 'article.hbs' + // })) if (htmlmin) metalsmith.use(htmlmin()); // minify production HTML if (debug) metalsmith.use(debug()); // output page debugging information if (browsersync) metalsmith.use(browsersync({ // start test server - server: dir.dest, - files: [dir.source + '**/*'] + server: dir.dest, + files: [dir.source + '**/*'] })); metalsmith - .use(sitemap({ // generate sitemap.xml - hostname: siteMeta.domain + (siteMeta.rootpath || ''), - omitIndex: true // replace any paths ending in index.html with ''. Useful when you're using metalsmith-permalinks. - })) - .use(rssfeed({ // generate RSS feed for articles - collection: 'article', - site_url: siteMeta.domain + (siteMeta.rootpath || ''), - title: siteMeta.name, - description: siteMeta.desc - })) - .use(assets({ // copy assets: CSS, images etc. - source: dir.source + 'assets/', - destination: './' - })) + .use(sitemap({ // generate sitemap.xml + hostname: siteMeta.domain + (siteMeta.rootpath || ''), + omitIndex: true // replace any paths ending in index.html with ''. Useful when you're using metalsmith-permalinks. + })) + .use(rssfeed({ // generate RSS feed for articles + collection: 'article', + site_url: siteMeta.domain + (siteMeta.rootpath || ''), + title: siteMeta.name, + description: siteMeta.desc + })) + .use(assets({ // copy assets: CSS, images etc. + source: dir.source + 'assets/', + destination: './' + })) - .build(function (err) { +.build(function(err) { if (err) throw err; - }); - - +}); \ No newline at end of file diff --git a/build/article/future/index.html b/build/article/future/index.html index 26da338..18ccdf6 100644 --- a/build/article/future/index.html +++ b/build/article/future/index.html @@ -30,11 +30,17 @@ Home
  • - Start + docs
  • Articles
  • +
  • + tutorials +
  • +
  • + boxes +
  • Contact
  • @@ -64,7 +70,7 @@ Gulp
  • - Future publication + Future publication
  • @@ -105,6 +111,8 @@

    Help make this page better. Edit here >>

    + + diff --git a/build/article/gotchas/index.html b/build/article/gotchas/index.html index 29a026d..cc64cce 100644 --- a/build/article/gotchas/index.html +++ b/build/article/gotchas/index.html @@ -30,11 +30,17 @@ Home
  • - Start + docs
  • Articles
  • +
  • + tutorials +
  • +
  • + boxes +
  • Contact
  • @@ -58,7 +64,7 @@ Usage options
  • - Gotchas + Gotchas
  • Gulp @@ -114,6 +120,8 @@

    Help make this page better. Edit here >>

    + + diff --git a/build/article/gulp/index.html b/build/article/gulp/index.html index 3adf57d..2d47fad 100644 --- a/build/article/gulp/index.html +++ b/build/article/gulp/index.html @@ -30,11 +30,17 @@ Home
  • - Start + docs
  • Articles
  • +
  • + tutorials +
  • +
  • + boxes +
  • Contact
  • @@ -61,7 +67,7 @@ Gotchas
  • - Gulp + Gulp
  • Future publication @@ -131,6 +137,8 @@ gulp.task('html', function() {

    Help make this page better. Edit here >>

    + + diff --git a/build/article/index.html b/build/article/index.html index be45e9f..918037c 100644 --- a/build/article/index.html +++ b/build/article/index.html @@ -30,11 +30,17 @@ Home
  • - Start + docs
  • Articles
  • +
  • + tutorials +
  • +
  • + boxes +
  • Contact
  • @@ -133,6 +139,8 @@

    Help make this page better. Edit here >>

    + + diff --git a/build/article/usage/index.html b/build/article/usage/index.html index 269d99e..d2349ed 100644 --- a/build/article/usage/index.html +++ b/build/article/usage/index.html @@ -30,11 +30,17 @@ Home
  • - Start + docs
  • Articles
  • +
  • + tutorials +
  • +
  • + boxes +
  • Contact
  • @@ -55,7 +61,7 @@