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

underscore-template-loader

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore-template-loader - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

21

index.js

@@ -8,16 +8,16 @@ var _ = require('underscore');

var includeRegex = /<!--include\s+([\/\w\.]*?[\w]+\.[\w]+)-->/g;
var readFile = function(filepath, root) {
var self = readFile;
self.buffer = self.buffer || {};
if (filepath in self.buffer)
return self.buffer[filepath];
var content = readContent(fs.readFileSync(path.join(root, filepath), 'utf8'), root);
var content = readContent(fs.readFileSync(path.join(root, filepath), 'utf8'), root);
self.buffer[filepath] = content;
return self.buffer[filepath];
};
var readContent = function(content, root) {
var readContent = function(content, root) {
var matches = includeRegex.exec(content);

@@ -34,4 +34,11 @@

};
return function(content) {
if (this.query.length) {
var query = loaderUtils.parseQuery(this.query);
_.each(query, function(value, key){
_.templateSettings[key] = new RegExp(value, 'g');
});
};
this.cacheable && this.cacheable();

@@ -38,0 +45,0 @@ var callback = this.async();

{
"name": "underscore-template-loader",
"version": "0.2.5",
"version": "0.2.6",
"description": "A Underscore template loader for Webpack",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,2 +26,21 @@ underscore-template-loader

```
<br/>
**Set underscore template settings**
```javascript
module.exports = {
//...
loaders: [
//...
{
test: /\.html/,
loader: "underscore-template-loader",
query: {
interpolate : '\\{\\[(.+?)\\]\\}',
evaluate: '\\{%([\\s\\S]+?)%\\}',
escape : '\\{\\{(.+?)\\}\\}'
}
}
]
};
```

@@ -28,0 +47,0 @@ <br/>

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