neilthawani / panhandle Goto Github PK
View Code? Open in Web Editor NEWCompile Handlebars Templates in a Github Pages Static Site
Compile Handlebars Templates in a Github Pages Static Site
Otherwise this breaks lib/handlebars-to-html.js
This is related to the other async/await issues in the code base.
In order to avoid callback hell, I used async--await
. However, it is not waiting until some files are created before executing later functions.
Not sure what I'm doing wrong.
Sample code, for future reference: https://gist.githubusercontent.com/BinuraG/b4a07e73e934630ea5483a60ac6c0d2c/raw/f6a8ae846dc00ce1342dfe4c09204d6bb7c15051/main.js
// node build/build.js -d cwd -p "src/views/partials/**/*.hbs" -l "src/views/layouts/**/*.hbs" -t "src/views/templates/**/*.hbs" -v
let commander = require("commander");
let config = require("../config/config");
let handlebarsToHtml = require("../lib/handlebars-to-html");
commander
.usage("-templates <pattern> -d <path>")
.description("Write handlebars templates to a directory as static html.")
.option("-d, --directory", "output directory")
.option("-H, --helpers", "path to JavaScript file containing helpers")
.option("-p, --partials [pattern]", "glob pattern to match partial files")
.option("-l, --layouts [pattern]", "glob pattern to match layout files")
.option("-t, --templates <pattern>", "glob pattern to match template files")
.option("-v, --verbose", "output more information to console")
.parse(process.argv);
if (commander.verbose) {
process.env.debug = true;
}
if (commander.partials) {
handlebarsToHtml.registerPartials(commander.partials, config.views.partialsFolder);
}
if (commander.layouts) {
handlebarsToHtml.registerPartials(commander.layouts, config.views.layoutsFolder);
}
handlebarsToHtml.writeFiles(commander.templates, config.views.templatesFolder);
In lib/config.js
, the user's package.json
file is set up and installed in setupPackageJson
, according to the settings
object.
This could be enhanced slightly by adding a prompt so that the user can append a description
and author
field to the settings
object based on their own user input.
This is an enhancement that would make panhandle more "framework-like."
If someone edits their projectName/config/config.js
file, the build
script should rewrite the other scripts in package.json
and index.js
to reflect the changed values.
In lib/config.js
, the user's package.json
file is set up and installed in setupPackageJson
.
The childProcess
package is then used to run npm install ${settings}
in the user's current working directory.
I'm not sure this is the correct syntax, but I'm not sure why it's not working properly, nor in the desired order.
Icon library uses icons like:
line height: 1
There should be an example of this in the repo too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.