Marius <[email protected]> writes: > 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".
I can't help to think this is a bit too low level. I would hate to have to go in and modify LiftRules everytime I add/change something on a page. Or maybe I don't understand it correctly? The way I see it, we can have some named values that corresponds to files that need to be included (not sure about actual syntax), ie In snippet A: I need flot In snippet B: I need flot-piechart-plugin It seems fairly straight forward to compute a tree of dependencies (basically the JsDependencyTree) having the correct order depending on the above declarations: Process snippets in order and avoid duplicates: A needs Flot which needs Jquery -> [jquery, flot] B needs flot-piechart-plugin which needs flot which needs jquery -> [jquery, flot] ++ [jquery, flot, flot-piechart-plugin] = [jquery, flot, flot-piechart-plugin] There will have to be some validations (circular dependencies etc), but this should be fixable.... > 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. That would be cool.... /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
