grunt-contrib-templify
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,5 @@ module.exports = { | ||
return "Templify = {}; Templify.install = function(Vue, options) {\n" + | ||
"\tVue.templified = function(name) {\n" + | ||
"\toptions = options || {};" + | ||
"\toptions.name = options.name || \"templified\";\n" + | ||
"\tVue[options.name] = function(name) {\n" + | ||
"\t\tswitch(name) {\n"; | ||
@@ -8,0 +10,0 @@ }, |
{ | ||
"name": "grunt-contrib-templify", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"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", |
@@ -10,2 +10,3 @@ # grunt-contrib-templify | ||
This project is designed for use with Grunt. If you don't already have it installed: | ||
```shell | ||
@@ -16,2 +17,3 @@ npm install grunt --save-dev | ||
To get this project added: | ||
```shell | ||
@@ -22,2 +24,3 @@ npm install grunt-contrib-templify --save-dev | ||
Then inside your grunt file you'll need to add a line to load this project: | ||
```javascript | ||
@@ -35,9 +38,10 @@ templify: { | ||
### Functionality | ||
### Modes | ||
Below is a general description of what the task is doing referenced by the various supported "modes" | ||
* generic | ||
#### generic | ||
The task creates a function that handles binding a beforeEach clause that adds the templates to a global template variable. The equivalent code for __templifyTemplates as an example: | ||
```javascript | ||
@@ -52,5 +56,6 @@ var __templates = {}; | ||
* angular | ||
#### angular | ||
The task creates a function that simply binds the templates to the $templateCache. The generated function for *__templifyTemplates* as an example: | ||
```javascript | ||
@@ -64,5 +69,6 @@ function($templateCache) { | ||
* vue | ||
#### vue | ||
The task creates a Vue Plugin to provide the HTML files as templates: | ||
```javascript | ||
@@ -79,4 +85,6 @@ var Templify = {}; | ||
}; | ||
``` | ||
To use the Plugin, your code will have to call | ||
```javascript | ||
@@ -87,2 +95,3 @@ Vue.use(Templify); | ||
And then your components should be able to access their templates: | ||
```javascript | ||
@@ -95,5 +104,14 @@ Vue.component("example", { | ||
* jasmine-angular (Also karma-angular) | ||
The Vue plugin accepts several option parameters as well | ||
##### Vue: options.name | ||
Type: `String` | ||
Default: 'templified' | ||
Sets the name of the method off of `Vue` where the templates are amde available. | ||
#### jasmine-angular (Also karma-angular) | ||
The task creates a function that handles binding a beforeEach clause that adds the templates to the $templateCache. The equivalent code for __templifyTemplates as an example: | ||
```javascript | ||
@@ -107,2 +125,3 @@ beforeEach( inject( function($templateCache) { | ||
### Options | ||
@@ -164,2 +183,3 @@ | ||
The current process is designed to be simple but not as smooth as desired. Initially the Grunt configuration needs to be put in place: | ||
```javascript | ||
@@ -180,2 +200,3 @@ templify: { | ||
``` | ||
(Note: that "testing" is an arbitrary label) | ||
@@ -186,2 +207,3 @@ | ||
In Karma's Grunt declaration: | ||
```javascript | ||
@@ -202,2 +224,3 @@ karma: { | ||
In your Jasmine tests: | ||
```javascript | ||
@@ -213,2 +236,3 @@ // ... | ||
For Example: | ||
```javascript | ||
@@ -215,0 +239,0 @@ describe("Templify Karma-Angular template processing", function() { |
@@ -87,3 +87,3 @@ /* | ||
} catch(exception) { | ||
grunt.log.writeln("Failed to read directory: " + dir + "\n" + JSON.stringify(exception, null, 4)); | ||
grunt.log.writeln("Failed to read directory:\n" + JSON.stringify(dir) + "\n> Exception:\n" + JSON.stringify(exception, null, 4)); | ||
} | ||
@@ -90,0 +90,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22303
319
252