grunt-angular-templates
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -42,2 +42,9 @@ /* | ||
ngtemplates: { | ||
multiple: { | ||
options: { | ||
base: 'test/fixtures' | ||
}, | ||
src: ['test/fixtures/multiple/**/*.html'], | ||
dest: 'tmp/multiple.js' | ||
}, | ||
simple: { | ||
@@ -47,3 +54,3 @@ options: { | ||
}, | ||
src: ['test/fixtures/**/simple.html'], | ||
src: ['test/fixtures/simple.html'], | ||
dest: 'tmp/simple.js' | ||
@@ -50,0 +57,0 @@ } |
{ | ||
"name": "grunt-angular-templates", | ||
"description": "Grunt build task to concatenate & register your AngularJS templates in the $templateCache", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/ericclemmons/grunt-angular-templates", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -1,5 +0,6 @@ | ||
# grunt-angular-templates | ||
# grunt-angular-templates [![Build Status](https://travis-ci.org/ericclemmons/grunt-angular-templates.png?branch=master)](https://travis-ci.org/ericclemmons/grunt-angular-templates) | ||
Grunt build task to concatenate & register your AngularJS templates in the $templateCache | ||
## Getting Started | ||
@@ -17,2 +18,3 @@ Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-angular-templates` | ||
## Documentation | ||
@@ -23,3 +25,6 @@ | ||
### Update Grunt: | ||
```js | ||
// grunt.js | ||
grunt.initConfig({ | ||
@@ -36,7 +41,37 @@ ngtemplates: { | ||
### Add template module to your app | ||
```js | ||
// js/app.js | ||
angular.module('app', [ | ||
'app.templates' // Generated by ngtemplates:app | ||
... | ||
]); | ||
``` | ||
## Changelog | ||
### v0.1.1 | ||
- Fixes | ||
- [Fails to combine multiple templates](https://github.com/ericclemmons/grunt-angular-templates/issues/1) | ||
- New | ||
- Added directions to README on how to integrate with AngularJS app | ||
- Integrated with TravisCI | ||
### v0.1.0 | ||
- Released to [NPM](https://npmjs.org/package/grunt-angular-templates) | ||
## Contributing | ||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt]. | ||
## License | ||
Copyright (c) 2013 Eric Clemmons | ||
Licensed under the MIT license. |
@@ -18,3 +18,3 @@ /* | ||
var id = path.relative(base, file); | ||
var template = '\n $templateCache.put("<%= id %>", "<%= content %>"\n );\n'; | ||
var template = '\n $templateCache.put("<%= id %>",\n "<%= content %>"\n );\n'; | ||
var cleaned = grunt.file.read(file).replace(/"/g, '\\"').replace(/\r?\n/g, '" +\n "'); | ||
@@ -26,3 +26,3 @@ var cached = grunt.template.process(template, { | ||
next(cached); | ||
next(null, cached); | ||
}, callback); | ||
@@ -34,6 +34,6 @@ }; | ||
concat(base, files, function(concated) { | ||
concat(base, files, function(err, concated) { | ||
var compiled = grunt.template.process(template, { | ||
id: id, | ||
content: concated | ||
content: concated.join('') | ||
}); | ||
@@ -40,0 +40,0 @@ |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var actual = grunt.file.read('tmp/simple.js'); | ||
var actual = grunt.file.read('tmp/simple.js'); | ||
var expected = grunt.file.read('test/expected/simple.js'); | ||
@@ -17,4 +17,14 @@ | ||
test.done(); | ||
}, | ||
multiple: function(test) { | ||
test.expect(1); | ||
var actual = grunt.file.read('tmp/multiple.js'); | ||
var expected = grunt.file.read('test/expected/multiple.js'); | ||
test.equal(expected, actual, 'should compile multiple templates together as `multiple.templates`'); | ||
test.done(); | ||
} | ||
}; |
angular.module("simple.templates", []).run(["$templateCache", function($templateCache) { | ||
$templateCache.put("simple.html", "Howdy there! Your name is \"{{ name }}\"." + | ||
$templateCache.put("simple.html", | ||
"Howdy there! Your name is \"{{ name }}\"." + | ||
"" | ||
@@ -5,0 +6,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
8678
15
161
75