Skip to content

neilthawani/handlebars-to-html

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handlebars-to-html

Generate static html files from handlebars templates.

Note: cwd is the base project path.

Sample folder structure:

cwd/src/views
|_layouts
|__base.hbs
|_partials
|__blog
|___post.hbs
|_templates
|__index.hbs

Note: /templates should always contain an index.hbs file, given this project's config (see handlebars-to-html::writeFiles, lines 47-51).

Sample layout:

<!-- cwd/src/views/layouts/base -->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
  <head>
    <title>Title</title>
    <link type="text/css" href="/styles/main.css" rel="stylesheet">
  </head>

  <body>
  {{> @partial-block }}
  </body>
</html>

Sample index template:

<!-- cwd/src/views/templates/index.hbs -->
{{#> base}}
  {{> blog/post}}
{{/base}}

Building:

Run:

node index.js -d cwd -p "src/views/partials/**/*.hbs" -l "src/views/layouts/**/*.hbs" -t "src/views/templates/**/*.hbs" -v

from the command line, given the default parameters in index.js. This outputs .html files to the cwd in the same folder structure as your compiled src/views/templates folder.

About

Generate static html files from handlebars templates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%