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

handlebars-loader

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-loader

handlebars loader module for webpack

  • 1.7.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125K
increased by25.44%
Maintainers
3
Weekly downloads
 
Created

What is handlebars-loader?

The handlebars-loader package is a webpack loader that allows you to precompile Handlebars templates. It integrates Handlebars with your webpack build process, enabling you to use Handlebars templates in your JavaScript applications seamlessly.

What are handlebars-loader's main functionalities?

Basic Template Loading

This feature allows you to load Handlebars templates using the handlebars-loader. The code sample shows a basic webpack configuration that uses handlebars-loader to process files with the .hbs extension.

module.exports = {
  module: {
    rules: [
      {
        test: /\.hbs$/,
        loader: 'handlebars-loader'
      }
    ]
  }
};

Precompile Templates

This feature allows you to precompile Handlebars templates and use them in your JavaScript code. The code sample demonstrates how to require a Handlebars template, pass a context object to it, and generate HTML.

const template = require('./template.hbs');
const context = { title: 'My New Post', body: 'This is my first post!' };
const html = template(context);
console.log(html);

Custom Helper Registration

This feature allows you to register custom Handlebars helpers. The code sample shows how to configure handlebars-loader to look for custom helpers in a specified directory.

module.exports = {
  module: {
    rules: [
      {
        test: /\.hbs$/,
        loader: 'handlebars-loader',
        options: {
          helperDirs: [path.resolve(__dirname, 'helpers')]
        }
      }
    ]
  }
};

Other packages similar to handlebars-loader

FAQs

Package last updated on 08 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