-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module option #10
Comments
Hi! I don't know if I understand well enough, but I do know you can change ngtemplates: {
mymodule: {
src: ['app/templates/**/*.html'],
dest: 'mymodule/templates.js'
}
}, This will create As for the last line about "don't have to run a build", are you saying that you only want to use the templates as the app, without a "parent" module? Thanks for opening an issue, btw! |
Right, I get how it currently works. I mean instead of creating a new module named So for example, say I have an angular module named app: angular.module('app', []); Now I tell the grunt plugin to add all my templates to it (rather than to a separate module): ngtemplates: {
app: {
src: ['app/templates/**/*.html'],
dest: 'app/templates.js',
module: 'app'
}
} And now app/templates.js would look like this: angular.module("app").run(["$templateCache", function($templateCache) {
$templateCache.put("app/templates/partial1.html",
"<h1>Users</h1>"...
);
$templateCache.put("app/templates/partial2.html",
"<p>This is the partial for view 2.</p>"...
);
}]); Does that make sense? So it adds the templates to my app module, rather than to a separate module that I need to declare as a dependency to my module. |
Ooh!! I see! I like that a lot better! :D The one downside is that you'd have to ensure the template is included after the fact (whereas |
I like this! |
Wow that was fast! Rock on dudes. This is a great improvement. |
Thanks for the PR! Take a look @ some of my other grunt projects & open up issues if you see anything! |
What about this idea: instead of creating app.templates module, just let people specify the name of the module to add templates to:
That way you wouldn't have to specify a dependency:
The benefit of this is you don't have to run a build before being able to use your app.
The text was updated successfully, but these errors were encountered: