diff --git a/gulpfile.js b/gulpfile.js index 0629a1e..05f94e4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,9 +2,10 @@ const hippie = { brand: 'hippie', jsFile: 'main', - jsonFile: 'db' + jsonFile: 'db', + index: 'demo.html', + data: 'demo/data.json' } - // Gulp requirements const { watch, series, parallel } = require('gulp'); const { src, dest } = require('gulp'); @@ -68,6 +69,14 @@ const output = { vendor: 'build/vendor' }; +//Check for index file and deactivate demo content +if (fs.existsSync('source/screens/index.*')){ + hippie.index = 'index.html'; +} +if (fs.existsSync('source/templates/data.json')){ + hippie.data = 'data.json'; +} + // Create tasks // Clean build folder @@ -99,7 +108,7 @@ function nunjucks() { return src(input.screens) .pipe(plumber()) .pipe(data(function() { - let data = JSON.parse(fs.readFileSync(input.demo.data)); + let data = JSON.parse(fs.readFileSync(input.templates +'/'+ hippie.data)); object = {hippie, data}; return object; })) @@ -115,7 +124,7 @@ function nunjucks() { // Serve files to the browser function serve(done) { server.init({ - index: "demo.html", + index: hippie.index, open: false, server: output.root }); diff --git a/source/screens/demo.njk b/source/screens/demo.njk index 42f8b9b..6d30899 100644 --- a/source/screens/demo.njk +++ b/source/screens/demo.njk @@ -14,10 +14,13 @@
You can start using it by replacing this file with your own index page.
-To do this you need to open the file /gulpfile.js and comment out the line index: "demo.html",. Then you need to place your index file (index.njk) into the folder /source/pages.
For a very basic start you can make a copy of the demo page blank.njk. You can find it at /source/pages/demo.
The demo folder contains an overview of all elements and also examples for style combinations and even whole page layouts.
Follow the white rabbit.
To do this you need to create a file /index.njk inside the source/screens folder. You can also create a data.json file inside the source/templates folder as a data source for your nunjucks files.
For a very basic start you can make a copy of the demo page blank.njk. You can find it at /source/screens/demo.
The source/demo folder contains an overview of all HTML elements and also examples for CSS style combinations and even whole page layouts.
Follow the white rabbit.
()()+
(..)
C(")(")
()()-
(..)
C(")(")