grunt-angular-templates
Advanced tools
Comparing version 0.2.2 to 0.3.0
{ | ||
"name": "grunt-angular-templates", | ||
"description": "Grunt build task to concatenate & register your AngularJS templates in the $templateCache", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/ericclemmons/grunt-angular-templates", | ||
@@ -25,4 +25,3 @@ "author": { | ||
"engines": { | ||
"node": "0.8.x", | ||
"npm": "1.1.x" | ||
"node": ">= 0.8.0" | ||
}, | ||
@@ -33,5 +32,5 @@ "scripts": { | ||
"devDependencies": { | ||
"grunt": "0.4.0rc7", | ||
"grunt-contrib-jshint": "~0.1.0", | ||
"grunt-contrib-nodeunit": "~0.1.1", | ||
"grunt": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.1.1", | ||
"grunt-contrib-nodeunit": "~0.1.2", | ||
"grunt-cli": "~0.1.6" | ||
@@ -38,0 +37,0 @@ }, |
@@ -8,3 +8,3 @@ # grunt-angular-templates [![Build Status](https://travis-ci.org/ericclemmons/grunt-angular-templates.png?branch=master)](https://travis-ci.org/ericclemmons/grunt-angular-templates) | ||
- Use `0.1.x` for Grunt `0.3.x`. | ||
- Use `0.2.x` for Grunt `0.4.x`. | ||
- Use `0.2.x` or `0.3.x` for Grunt `0.4.x`. | ||
@@ -30,3 +30,3 @@ | ||
### Update Grunt: | ||
### Update Grunt | ||
@@ -37,3 +37,3 @@ ```js | ||
ngtemplates: { | ||
app: { | ||
myapp: { | ||
options: { base: 'src/views' }, | ||
@@ -47,15 +47,42 @@ src: [ 'src/views/**.html' ], | ||
### Add template module to your app | ||
**You should name your sub-target (e.g. `myapp`) after the name of the module the templates will be added to**. | ||
This will generate the following at `dist/templates.js`: | ||
```js | ||
// js/app.js | ||
angular.module('app', [ | ||
'app.templates' // Generated by ngtemplates:app | ||
angular.module('myapp').run(['$templateCache', function($templateCache) { | ||
... | ||
]); | ||
}]); | ||
``` | ||
### Include Compiled Templates | ||
This can either be done via HTML: | ||
```html | ||
<script src="dist/templates.js"></script> | ||
``` | ||
or via your Gruntfile: | ||
```js | ||
concat: { | ||
myapp: { | ||
src: [ | ||
'src/js/**/*.js', // MyApp module first | ||
'<%= ngtemplates.myapp.dest %>' // Generated templates | ||
], | ||
dest: 'dist/js/app.js' | ||
} | ||
} | ||
``` | ||
## Changelog | ||
### v0.3.0 | ||
- **BC break** - Templates are added to an existing module (e.g. `myapp`) rather than being their own `myapp.templates` module to be manually included, thanks to @geddesign. ([#10](https://github.com/ericclemmons/grunt-angular-templates/issues/10)) | ||
### v0.2.2 | ||
@@ -62,0 +89,0 @@ |
@@ -18,3 +18,3 @@ /* | ||
grunt.registerMultiTask('ngtemplates', 'Compile AngularJS templates', function() { | ||
var id = this.target + '.templates'; | ||
var id = this.target; | ||
var base = grunt.file.expand(this.options().base || '.')[0]; | ||
@@ -21,0 +21,0 @@ var files = grunt.file.expand(this.files[0].src); |
@@ -33,3 +33,3 @@ /* | ||
var compile = function(id, base, files, callback) { | ||
var template = 'angular.module("<%= id %>", []).run(["$templateCache", function($templateCache) {\n<%= content %>\n}]);\n'; | ||
var template = 'angular.module("<%= id %>").run(["$templateCache", function($templateCache) {\n<%= content %>\n}]);\n'; | ||
@@ -36,0 +36,0 @@ concat(base, files, function(err, concated) { |
@@ -1,2 +0,2 @@ | ||
angular.module("multiple.templates", []).run(["$templateCache", function($templateCache) { | ||
angular.module("multiple").run(["$templateCache", function($templateCache) { | ||
@@ -3,0 +3,0 @@ $templateCache.put("multiple/one.html", |
@@ -1,2 +0,2 @@ | ||
angular.module("simple.templates", []).run(["$templateCache", function($templateCache) { | ||
angular.module("simple").run(["$templateCache", function($templateCache) { | ||
@@ -3,0 +3,0 @@ $templateCache.put("simple.html", |
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
10511
15
131