New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

page-crafter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

page-crafter

Page Crafter =======================

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Page Crafter

A tool for simply templating content pages using handlebars templating syntax with partials support.

Usage

pagecraft <dir> [options]

All files with a .handlebars extension will be run through the handlebars templating engine.

Any handlebars files with a leading _ underscore in the name will be registered as partials and not available in the final output.

All other files will be copied as-is to the output directory.

Options

optionDescription
-h,--helphelp message
-o,--outSpecify 'out' directory; default 'dist'
-p,--paramsSpecify a YAML parameter file to be used as template context
-c,--cleanRemove the 'out' directory before build
-v,--versionPrint version information

Example

Given the following input directory structure:

website/
├── css/
│   ├── bootstrap.min.css
│   └── bootstrap-theme.min.css
├── js/
│   └── bootstrap.min.js
├── shared-partials/
│   ├── _navbar.html.handlebars
│   └── _footer.html.handlebars
├── index.html.handlebars
└── about-us.html.handlebars

A YAML parameter file named web-params.yml at the same level as website/ with the following contents:

---
sales_phone: 555-555-5555
sales_email: sales@example.org

And running the following command:

pagecraft website/ -o dist/ -p web-params.yml

The following will occur:

  1. All files in css/ and js/ will be copied as-is to a new dist/ folder
  2. Partials named shared-partials/_navbar.html and shared-partials/_footer.html will be registered and available to be used in the index.html.handlebars and about-us.html.handlebars files as {{> shared-partials/_navbar.html }}. Notice that they are namespaced by their relative folder.
  3. The sales_phone and sales_email contents of web-params.yml will be available as context for each template.
  4. An index.html and about-us.html will be created in the dist/ folder after running through the handlebars templater with all available partials and context parameters.

The output will be:

dist/
├── css/
│   ├── bootstrap.min.css
│   └── bootstrap-theme.min.css
├── js/
│   └── bootstrap.min.js
├── shared-partials/
├── index.html
└── about-us.html

Keywords

FAQs

Package last updated on 09 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc