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

broccoli-handlebars

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-handlebars - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

8

index.js

@@ -23,2 +23,5 @@ var path = require('path');

this.context = this.options.context || {};
this.destFile = this.options.destFile || function (filename) {
return filename.replace(/(hbs|handlebars)$/, 'html');
};
this.handlebars = this.options.handlebars || Handlebars;

@@ -72,8 +75,7 @@

function write (output) {
var targetHTMLFile = targetFile.replace(/(hbs|handlebars)$/, 'html');
var destFilepath = path.join(destDir, targetHTMLFile);
var destFilepath = path.join(destDir, self.destFile(targetFile));
mkdirp.sync(path.dirname(destFilepath));
var str = fs.readFileSync(path.join(sourceDir, targetFile)).toString();
var template = self.handlebars.compile(str);
fs.writeFileSync(path.join(destDir, targetHTMLFile), template(output));
fs.writeFileSync(destFilepath, template(output));
}

@@ -80,0 +82,0 @@ var output = ('function' !== typeof self.context) ? self.context : self.context(targetFile);

{
"name": "broccoli-handlebars",
"version": "0.0.5",
"version": "0.0.6",
"description": "Compile handlebars templates with helpers and dynamic contexts",

@@ -5,0 +5,0 @@ "repository": "https://github.com/moudy/broccoli-handlebars",

@@ -23,3 +23,4 @@ # Broccoli Handlebars

, partials: 'partials-path'
, context: function (filename) { return dataForFile(filename); };
, context: function (filename) { return dataForFile(filename); }
, destFile: function (filename) { return filename.replace(/\.(hbs|handlebars)$/, ''); }
});

@@ -65,3 +66,15 @@ ```

#### destFile (optional)
A function that returns the name of a Handlebars-compiled file in the Broccoli output tree. The function is called for every input file, with `filename` supplied. If no function is supplied, the default is for the .hbs or .handlebars suffix of `filename` to be replaced with .html. E.g. `example.hbs` becomes `example.html`.
```js
var tree = broccoliHandlebars(tree, {
destFile: function (filename) { return filename.replace(/\.(hbs|handlebars)$/, ''); }
});
// Generate output files like Rails sprockets
// example.json.hbs -> example.json
```
#### helpers (optional)

@@ -68,0 +81,0 @@ An object of helpers or a function that returns an object of helpers.

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