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
Added "template" to options #982
Conversation
Now "directory.html" can be copied and modified without making changes to the distribution code.
Seems reasonable, but the setting of |
Thanks for the tip - now that I'm a bit more familiar with what's happening, I'm thinking something like "Theme" might be more applicable. I'll wait to submit that as an alternative to this suggestion until I'm more clear on how to approach it. |
can't wait for this one thank you |
@Earl-Brown |
Changed this.template to exports.template
@dougwilson: I didn't understand what you meatn by "inside exports.html", but I made the change in "directory.js". |
@gottaloveit: If I'm going to put "theme" support in, I'll be looking at very long-term goals...here are the notes I've made from the header comment. In my "personal" branch of the code, I've made an "exports.utilities" for all of the "support" functions: return { /**
All who are watching please provide feedback. ...and is there a better place for this discussion? |
that looks awesome too, but i am just as excited to see the template option being added |
@Earl-Brown "exports.html" is the name of the function in |
@@ -73,6 +72,9 @@ exports = module.exports = function directory(root, options){ | |||
, view = options.view || 'tiles' | |||
, filter = options.filter | |||
, root = normalize(root + sep); | |||
|
|||
exports.template = options.template || __dirname + '/../public/directory.html'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment needs to be outside the function.
how is that gonna work when the options variable are inside the function? |
@gottaloveit it already does not work property, since the var connect = require('connect');
var app = connect();
app.use('/pub', connect.directory('./public/pub', {'template': './my/template.html'}));
app.use('/dev', connect.directory('./public/dev')); Now both are served up with the default template, since the second invocation overrode the setting from the first (since the setting is being set as a global). This PR should not accept a |
I just submitted a pull request with a suggested fix |
Isn't that the "constructor" function? I'll be honest, this is my first brush with the "exports" construct - I'm researching up on it right now. What I do know is that it works in the code - I'm using it that way right now. ...so when I assign "template" to "exports", it becomes a member of a singleton object, and is the only template to be used? I was shooting for making the template be per-directory. |
@Earl-Brown if you are trying to make it per-directory, then you need to incorporate the changes @gottaloveit suggested. Also, you need to add the |
@dougwilson - I'm sorry to say, but I don't know GitHub or the test platforms well enough to add tests. |
Now "directory.html" can be copied and modified without making changes to the distribution code.