Yes I believe this needs a bit more thinking. I didn;t spend too much time into this but perhaps add a LiftRules function to describe the dependency tree per page:
i.e. var jsDependencies : (Req) => JsDependencyTree where case class JsDependencyTree (url: String, dependencies: JsDependencyTree *) // not sure if we'd need more info The head merge (and potentially tail merge as well) mechanism in Lift would obtain the JsDependencyTree from LiftRules passing the Req (hence you can have a different dependency tree per page, or per application depending how you do pattern matching). Thus head merge would arrange the scripts according to the dependency tree. If a script is not in the dependency tree, it will just be appended to the scripts "list". Adjacent features that I see: 1. Detect if a dependency is missing 2. Construct a suite of dependency trees for most used JQuery plugins that people can easily re-use. Br's, Marius On Mar 1, 1:54 am, Peter Robinett <pe...@bubblefoundry.com> wrote: > Issue 281 is not going to make it into M3. The specific issue that > needs to be solved first is how to manage dependencies across multiple > snippets on one page. See the Assembla page for more > information:http://www.assembla.com/spaces/liftweb/tickets/281 > > Peter > > On Feb 26, 5:14 pm, Peter Robinett <pe...@bubblefoundry.com> wrote: > > > > > Mads, thanks for bringing ticket 281 to my attention, I'll address it > > in my patch. > > > Jeppe, that's how I plan on using it with Flot: having Flot.init > > register the plugins and in the charts call toHTML as needed. > > > Should have everything up on my pr1001_issue_322 branch by tomorrow. > > > Peter > > > On Feb 25, 1:14 am, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote: > > > > Peter Robinett <pe...@bubblefoundry.com> writes: > > > > Hi all, > > > > [...] > > > > > // Usage in boot.scala > > > > val myJsScript = new JsScript("flot" :: "jquery.flot.selectable.js" :: > > > > Nil) > > > > ResourceServer.allow(myJsScript.allowResource) > > > > > // Usage in a normal snippet > > > > def mySnippet = { > > > > <head> > > > > { myJsScript.toHTML } > > > > </head> > > > > <div> > > > > The rest of the snippet... > > > > </div> > > > > } > > > > > // Usage in a CometActor > > > > class myActor extends CometActor with JsScriptDependency { > > > > override def scripts = List(new JsScript("flot" :: > > > > "jquery.flot.selectable.js" :: Nil)); > > > > } > > > > > What do you think? It's a really quite basic but I think such an > > > > approach could work well for things like as lift-flot. > > > > It might be a start :-) I'm a little unsure if it supports the use case > > > I would like to see: > > > > I'm using jqPlot (a flot-like lib) and would like to, in boot, just > > > initialize the widget: > > > > jqPlot.init > > > > jqPlot comes with numerous plugins and this should be handled by the > > > widget. Whether a plugin is loaded on a page depends on some higher > > > level structure. Ie. if I wish to draw a pie chart, the pie chart plugin > > > should be loaded. > > > > Looking back at this, it seems like this could work with the above.... > > > > In init: register all plugins > > > In the specific charts, call toHtml on the plugins needed > > > > /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.