
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
karma-handlebars-preprocessor
Advanced tools
Preprocessor to compile Handlebars on the fly.
Forked from hanachin's code (kudos!)
Only works with Karma 0.9 or later which enables custom plugins.
For more information on Karma see the homepage.
a. Globally. System-wide with karma
available on command line.
```
npm install -g karma
npm install -g karma-handlebars-preprocessor
```
b. Locally. If you want to install Karma to your project instead, add the dependencies to package.json
and run npm install
:
```js
"devDependencies": {
"karma": ">=0.9",
"karma-handlebars-preprocessor": "*"
}
```
If you install locally, you'll need to run Karma using `node_modules/.bin/karma`.
In any case, the plugin needs to be installed as a peer dependency to Karma (i.e. in the sibling folder). This just means you cannot use global Karma with local plugins or vice-versa.
preprocessors: {
'**/*.hbs': 'handlebars'
}
or pass through the command line
$ karma start --preprocessors handlebars karma.conf.js
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');
}
}
});
};
This plugin precompiles templates using handlebars.js version 1.0.0
. You'll need to provide handlebars.runtime.js of the same version in your page.
MIT License
FAQs
A Karma plugin. Compile handlebars template on the fly.
The npm package karma-handlebars-preprocessor receives a total of 305 weekly downloads. As such, karma-handlebars-preprocessor popularity was classified as not popular.
We found that karma-handlebars-preprocessor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.