faassen / bowerstatic

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

Allow customizable injection point #61

Open Preston-Landers opened 9 years ago

Preston-Landers commented 9 years ago

For my use case it's very handy to be able to control the injection point, rather than always at the end of the </head> tag. This change allows you to choose a different injection point.

My reasoning is that sometimes I need to include my own CSS files after a Bower component so the CSS rendering rules prioritize my styles given the same specifier. I think this can probably be accomplished by making all my CSS files a bowerstatic local component, but I prefer having the flexibility over the inclusion point.

faassen commented 9 years ago

Looks like a good patch, but it also needs tests. There is some tricky fallback logic here which uses the </head> after all if the injection point cannot be found.

We also need some documentation improvements to document this.

Preston-Landers commented 9 years ago

Cool. I'll look into some testing and the docs. Honestly I'm not sure the fallback logic is really necessary - and it isn't needed for my personal purposes.