Socket
Socket
Sign inDemoInstall

grunt-contrib-templify

Package Overview
Dependencies
11
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

.npmignore

3

builders/angular.js

@@ -10,4 +10,5 @@ module.exports = {

"suffix": function(options) {
return "};\n";
return "};\n" +
(options.autoAffix?"angular.module(" + options.module + ").run(__templifyTemplates);":"");
}
};
{
"name": "grunt-contrib-templify",
"version": "0.2.1",
"version": "0.2.2",
"description": "A simple project for quick and dirty conversion of HTML files to javascript for various cases, particularly unit testing.",

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

@@ -23,8 +23,23 @@ # grunt-contrib-templify

Example Gruntfile Entry:
```javascript
templify: {
// ...
}
// ...
"templify": {
"example": {
"templates": [{
"path": "templates/*.html",
"rewrite": function(path) {
return path.substring(path.lastIndexOf("/") + 1);
}
}],
"mode": "angular",
"output": "templates.js"
}
},
// ...
```
Where the above example would scan
Then configure the templify task in your grunt configuration (See below).

@@ -67,4 +82,5 @@

The task creates a Vue Plugin to provide the HTML files as templates:
The task creates a Vue Plugin to provide the HTML files as templates.
General output file:
```javascript

@@ -141,3 +157,3 @@ var Templify = {};

The path to the folder where the templates are currently located
Glob like description to find files. See https://www.npmjs.com/package/glob for full details.

@@ -148,22 +164,8 @@ #### templates[].rewrite

This function is passed the current path to the template and is expected to return the name to use for the template, which by default is merely the current path. This options allos the name to programmatically created based on the path to the template.
This function is passed the current path to the template and is expected to return the name to use for the template, which by default is merely the current path. This options allows the name to programmatically created based on the path to the template.
The second argument is the current directory object **templates[]** for further manipulation if desired.
#### templates[].trim
Type: `String`
If the file should be skipped, then null should be returned instead of a String.
*Currently unused.* Future use to specify text to trim from the begining or end of the path. This is more accurately accomplished with **templates[].rewrite**.
#### templates[].prefix
Type: `String`
*Currently unused.* Future use to apply a simple prefix to the template name. This is more accurately accomplished with **templates[].rewrite**.
#### templates[].suffix
Type: `String`
*Currently unused.* Future use to apply a simple suffix to the template name. This is more accurately accomplished with **templates[].rewrite**.
#### mode

@@ -177,3 +179,3 @@ Type: `String`

Indicates where to output the javascript.
Indicates where to output the javascript file with the stringified templates.

@@ -200,3 +202,3 @@ #### autoAffix

templates: [{
path: "templates/",
path: "templates/*.html",
rewrite: function(path) {

@@ -206,3 +208,2 @@ return path.substring(path.lastIndexOf("/") + 1);

}],
suffixes: [".html"],
mode: "karma-angular",

@@ -209,0 +210,0 @@ output: "specs/templates.js"

@@ -74,5 +74,3 @@ /*

}
/* Deprecated flat directory search
dir.files = fs.readdirSync(dir.path);
*/
if(dir.path[0] !== "/") dir.path = options.appRoot + "/" + dir.path;
dir.files = glob.sync(dir.path);

@@ -84,8 +82,10 @@

name = dir.rewrite(path, dir);
templates[name] = {
"name": name,
"path": path,
"html": content,
"module": dir.module
};
if(name) {
templates[name] = {
"name": name,
"path": path,
"html": content,
"module": dir.module
};
}
});

@@ -92,0 +92,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc