Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JavaScript libraries - best practice?
#1
When developing a theme or a plugin that requires a JavaScript library, isn't there a risk of different libraries colliding? Could/should Get Simple have something in its API for helping with this? I wonder if, in the future, JavaScript libraries should be provided as plugins, and plugins should have ways of stating that they require another plugin to be enabled before they themselves can be enabled? This could guard against problems like Connie's 4th point here.

Also, related to this, different people have different views on where JavaScript should be placed in the HTML. I've just started a theme which is based on HTML5 Boilerplate, where JS libraries and scripts are placed mostly at the end of the HTML. However, the I18N Gallery plugin places its link to jQuery and all its scripts in the <head> - presumably because this is the only place into which plugin developers can reliably inject their code - through the get_header() template tag.

So, on that second issue, would it be good to introduce a new template tag/function - get_scripts() - to allow themers to decide where to include this stuff?
Reply


Messages In This Thread
JavaScript libraries - best practice? - by Mark Nielsen - 2012-03-24, 20:44:40



Users browsing this thread: 1 Guest(s)