-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
add rendering and loading from templates/
directory, not just copying from cwd?
#1
Comments
I can't remember if app.onLoad(/(^|[\\\/])templates[\\\/]/, function(file, next) {
var userDefined = app.home('templates', file.relative);
if (utils.exists(userDefined)) {
file.contents = fs.readFileSync(userDefined);
} else {
userDefined = app.home('templates', file.basename)
if (utils.exists(userDefined)) {
file.contents = fs.readFileSync(userDefined);
}
}
if (/^templates[\\\/]/.test(file.relative)) {
file.path = path.join(app.cwd, file.basename);
}
next(null, file);
});
Can you clarify? Wouldn't render already be skipped if the file doesn't exist? lol |
Not sure enough. Should review |
@jonschlinkert actually index.js#L55-L57 yea it will skip the file. The idea is to skip the stuff before it, options mergin and etc. So if it is not a template file we can just use it worth, imho. |
How would we differentiate between files that have templates variables that need to be resolved, and files that don't? might be nice to have a convention for this. I think You can already disable rendering on individual files, I don't think options merging for a few files have any noticeable performance impact. I'm open to suggestions though |
actually, i think i have idea. what about when sorry for not have formatting, but im on phone now |
and to not forget, it should also be overidden if opts.render is given edit: even if it not make sense to render if file isnt template |
I'm opening this one for me, cuz I'm going to PR this tonight.
Because I have this
CONTRIBUTING.md
file template and need rendering.Actually, is
update
trying to load templates from global~/templates
directory?edit: btw, got the idea for something like
is-template-file
package - sounds reasonable to have such thing? So we will be able to skip render cycle if it's not needed. Maybe streaming plugin.The text was updated successfully, but these errors were encountered: