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

karma-handlebars-preprocessor

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-handlebars-preprocessor

A Karma plugin. Compile handlebars template on the fly.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
279
decreased by-16.72%
Maintainers
1
Weekly downloads
 
Created
Source

karma-handlebars-preprocessor

Build Status npm version

Preprocessor to compile Handlebars on the fly.

Forked from hanachin's code (kudos!)

Works with Karma 0.9 or later.

For more information on Karma see the homepage.

Installation

  1. Install karma-handlebars-preprocessor plugin.
$ npm install karma-handlebars-preprocessor --save-dev
  1. Define it as a preprocessor in the config file
  preprocessors: {
    '**/*.hbs': 'handlebars'
  }

or pass through the command line

  $ karma start --preprocessors handlebars

Configuration

You can configure default behaviour in the handlebarsPreprocessor section of the config file. The following shows the default implementation:

// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.hbs': ['handlebars']
    },

    handlebarsPreprocessor: {
      // name of the variable to store the templates hash
      templates: "Handlebars.templates",

      // translates original file path to template name
      templateName: function(filepath) {
        return filepath.replace(/^.*\/([^\/]+)\.hbs$/, '$1');
      },

      // transforms original file path to path of the processed file
      transformPath: function(path) {
        return path.replace(/\.hbs$/, '.js');
      }
    }
  });
};

AMD Based Template Configuration

If you want to export your compiled templates as anonymous AMD modules, use the amd option in the config as shown below:

    handlebarsPreprocessor: {
      amd: true
    }

License

MIT License

Keywords

FAQs

Package last updated on 18 Aug 2015

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