Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@namics/nitro-component-handlebars

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@namics/nitro-component-handlebars

A handlebars helper to render a nitro component

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by900%
Maintainers
2
Weekly downloads
 
Created
Source

Nitro Component Handlebars Helper

npm version Build Status Coverage Status Codestyle

This helper allows to render a nitro component using handlebars

Installation

npm i --save-dev @namics/nitro-component-handlebars

Usage

const componentHandlebarsHelper = require('@namics/nitro-component-handlebars');
module.exports = componentHandlebarsHelper({
    rootDirectory: '/path/to/nitro/root'
})

Template usage

Default

The following code will render components/atoms/button/button.hbs:

{{component "components/atoms/button"}}

Child elements

The following code will set the value of {{children}} to 'Click me':

{{#component "components/atoms/button"}}
    Click me
{{/component}}

Attributes

The following code will set the value of {{size}} to 'xl':

{{component "components/atoms/button" size="xl"}}

Array attributes

The following code will set the value of {{sizes}} to ['xl', 'l']:

{{component "components/atoms/button" sizes="['xl', 'l']"}}

Data files

The following code will set the template variables to the content of components/atoms/button/_data/demo.json:

{{component "components/atoms/button" data-file="demo.json"}}

Rendering foreign modules

The following code will render a component from another node_module e.g. node_modules/base-pattern/components/atoms/button/button.json

{{component "~base-pattern/components/atoms/button"}}

Contribution

You're free to contribute to this project by submitting issues and/or pull requests. This project is test-driven, so keep in mind that every change and new feature should be covered by tests. This project uses the Codestyle.

License

This project is licensed under MIT.

Keywords

FAQs

Package last updated on 05 Jan 2017

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