various improvement and fixes
MODIFY
examples/build-website.js
examples/build-website.js
@@ -56,19 +56,19 @@ glob('examples/*/example.json')
pugTemplate = pugTemplate.replace('extends ../common/index.pug', '');
pugTemplate = pugTemplate.replace('block append mainContent', '');
}
- pugTemplate = `
-|---
-|layout: example
-|title: ${json.title}
-|about: ${json.about.text}
-|exampleCss: ${JSON.stringify(json.exampleCss)}
-|exampleJs: ${JSON.stringify(json.exampleJs)}
-|---
-|
-div` + pugTemplate;
+ pugTemplate = 'div' + pugTemplate;
var fn = pug.compile(pugTemplate, { pretty: false });
- fs.writeFileSync(path.resolve(output, 'index.html'), fn(json));
+ var html = fn(json);
+ html = `---
+layout: example
+title: ${json.title}
+about: ${json.about.text}
+exampleCss: ${JSON.stringify(json.exampleCss)}
+exampleJs: ${JSON.stringify(json.exampleJs)}
+---
+`+ html;
+ fs.writeFileSync(path.resolve(output, 'index.html'), html);
return json;
});

MODIFY
package.json
package.json
"start-test": "node examples/build.js; forever start ./testing/test-runners/server.js",
"stop-test": "forever stop ./testing/test-runners/server.js",
"docs": "jsdoc --pedantic -d dist/apidocs -r src -c jsdoc.conf.json",
- "build-website": "cp -a dist/built/. website/source/built && npm run build-website-examples && cp -a dist/apidocs/. website/source/apidocs && cd website && npx hexo generate && cd .. && cp -a website/public/. dist/website"
+ "website": "cd website && npx hexo server",
+ "build-website": "npm run build && cp -a dist/built/. website/source/built && npm run build-website-examples && npm run build-website-tutorials && npm run docs && cp -a dist/apidocs/. website/source/apidocs && cd website && npx hexo generate"
},
"keywords": [
"map",

MODIFY
website/README.md
website/README.md
-
Update website
==============
-- Run ```npm run build && npm run build-examples && npm run build-tutorials && npm run docs``` to build everything
-- Run ```npm run build-website``` to build the website, the output will be available under ```dist\website```
-- Copy ```dist\website``` to ```gh-pages``` branch to update the website
\ No newline at end of file
+- Run ```npm run build-website``` to build the website, the output will be available under ```website\public```
+- Copy ```website\public``` to ```gh-pages``` branch to update the website
+
+Develop website
+===============
+- Run ```npm run build-website```
+- Run ```npm run website``` and navigate to ```localhost:4000```. The website will update when there is a file change.
\ No newline at end of file

MODIFY
website/themes/agency/layout/example.ejs
website/themes/agency/layout/example.ejs
---
-layout: layout
navbar_affixed: true
no_footer: true
---

MODIFY
website/themes/agency/layout/layout.ejs
website/themes/agency/layout/layout.ejs
<a href="#page-top"></a>
</li>
<% var path = page_url(path); %>
- <li class="<% if(path == '/'){ %> active <% } %>">
+ <li class="<% if(path === config.root){ %> active <% } %>">
<a href="<%- page_url("/") %>">Welcome</a>
</li>
- <li class="<% if(path.indexOf('tutorial')!=-1){ %> active <% } %>">
+ <li class="<% if(path.indexOf('tutorial')!==-1){ %> active <% } %>">
<a href="<%- page_url("tutorials") %>">Tutorials</a>
</li>
- <li class="<% if(path.indexOf('example')!=-1){ %> active <% } %>">
+ <li class="<% if(path.indexOf('example')!==-1){ %> active <% } %>">
<a href="<%- page_url("examples") %>">Examples</a>
</li>
<li>

MODIFY
website/themes/agency/layout/tutorial.ejs
website/themes/agency/layout/tutorial.ejs
---
-navbar_affix: true
+navbar_affixed: true
no_footer: true
---
<link rel="stylesheet" href="../../css/tutorial.css">

various improvement and fixes