faassen / bowerstatic

Serve Bower-managed static resources using WSGI
BSD 3-Clause "New" or "Revised" License
49 stars 17 forks source link

Include at bottom #32

Open mrijken opened 10 years ago

mrijken commented 10 years ago

For some .js files, it's better to include them at the bottom of the html file. Do we want that feature in bowerstatic?

faassen commented 10 years ago

Yes, I'd like to support that. We had this in Fanstatic. In Fanstatic I had a whole complicated infrastructure about declaring resources "bottom safe" and including them by default in the bottom of the HTML file if so. I think we need something simpler in BowerStatic; perhaps just an argument to the inclusion so that the developer is in control of this behavior.

Plus perhaps a flag in the bower object that turns bottom includes on or off for all inclusions -- a default for this inclusion flag.

Does that make sense?

faassen commented 10 years ago

I just realized that this is related to the renderer (or extension) too. CSS and .ico should never be included at the bottom. So perhaps we should extend the notion of a renderer to also have knowledge about whether can be rendered at the bottom, by default "no".

faassen commented 10 years ago

This means it's relevant to issue #34, where we also talk about the renderer infrastructure.

faassen commented 10 years ago

See also #37

faassen commented 10 years ago

This issue implies we need to have renderer classes that can have a property set inject_bottom or something like that. But this affects the renderer infrastructure somewhat, as now it's function-based. I'd like to retain the function-based API as much as possible but support render classes. So this implies we need to wrap the render functions into a class, probably at the point of registration, if it's a function, with a default of inject_bottom set to False.