-
Notifications
You must be signed in to change notification settings - Fork 45
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
Template Destination Path and File Extension #47
Comments
I find this inconvenient as well. I'm surprised no one else has commented on this. |
In case anyone is looking for a quick workaround for this, I decided to just use this plugin to fix the paths: So you just run the string-replace plugin after the JST plugin. Going with @jcochran 's example, you just do something like this: 'string-replace': {
jst: {
files: {
'www/javascripts/templates.js': 'www/javascripts/templates.js'
},
options: {
replacements: [{
pattern: /www\/javascripts\/templates/ig,
replacement: 'templates'
}]
}
}
}, |
Yes, I went with something very similar. Sent from my iPhone On Sep 15, 2014, at 12:06 PM, "Travis Wimer" <[email protected]mailto:[email protected]> wrote: In case anyone is looking for a quick workaround for this, I decided to just use this plugin to fix the paths: So you just run the string-replace plugin after the JST plugin. Going with @jcochranhttps://github.com/jcochran 's example, you just do something like this: 'string-replace': { — |
You don't need a separate plugin for this. There is an option built right into this one, called jst: {
compile: {
options: {
processName: function(thatHugeFilepath){
return thatHugeFilepath.replace('/www/javascripts/templates/', 'templates');
}
}
}
} Of course, you can just as easily use any other string function to transform your template names. |
Thanks for explaining. That works perfectly. I actually saw that option in the README, but it I found it rather unclear. The description mentions the Rereading it now, it does make sense, but the wording could probably be clearer. |
I am working on using grunt with a backbone/cordova (phonegap)...
It would be nice to have a "dest_path" and "include_ext" options so you could set the destination folder of the template and whether or not to include the extension of the file name in the template name.
Example:
The end result is that each template has "www/javascripts/templates/" before each templat name:
The new option would like look like:
and the end results would be:
So in backbone I can refer to the templates as such:
Clear as mud?
BTW, thanks for the work on this. It is going to save me a bunch of time. 👍
The text was updated successfully, but these errors were encountered: