I think it's fine to have the default behavior be to inject script tags. That will suffice for 90% of our users, probably more. If you fall into the 10% that have some more complicated setup, we should provide a flag like > cordova plugin add --no-inject-js myplugin that prevents us from doing it automatically, and you can do whatever more complex step you need to do.
Braden On Wed, Feb 6, 2013 at 3:37 PM, Andrew Grieve <[email protected]> wrote: > On Wed, Feb 6, 2013 at 3:00 PM, Filip Maj <[email protected]> wrote: > > > > > > > On 2/6/13 11:51 AM, "Andrew Grieve" <[email protected]> wrote: > > > > >On Wed, Feb 6, 2013 at 2:33 PM, Filip Maj <[email protected]> wrote: > > > > > >> I've added a few detail explanations to the document, but moved the > > >> discussion to the ML. > > >> > > >> ---- > > >> > > >> > Should be easy to install / remove plugins (no need to manually > > >> >add/remove script tags) > > >> > > >> > > >> I think adding/removing script tags is the way to go. Concatenating > all > > >> javascript relevant to your project (cordova.js + any plugins you add) > > >> makes it difficult to debug later on. WE'd have to get users to post > > >> entire contents of their cordova.js file to determine what was added > and > > >> what exists in there. With that in mind, I favor the packager > approach, > > >> which would require: > > >> > > > > > >Very good point about concat making it hard to track bugs! I wonder if > > >there's a better way than requiring users to manually add the tags (we > > >don't require them to manually add native files to their project files). > > > > > >One thought is to have cordova-packer output source-maps. I don't think > > >there's very good support for them in mobile browsers yet, but we could > > >use > > >them to manually map exception line numbers to file+line numbers. > > > > > >Another idea is to use exec + special comment that is used in our > existing > > >pkg/debug/*.js files. I don't think support for this is all that great > > >either though. > > > > > >Another idea is to have cordova.js inject a script tag for each module. > > >This may have an adverse effect on start-up time, but probably no worse > > >than if the user manually adds all of the script tags separately. > Winner? > > > > I don't think the script tag is a giant issue, but I do think it is a > > slipper slope problem to try and solve. What if the user has a multipage > > application? Do we then add script tags automatically to all pages? What > > if the user only uses the plugin on specific pages? Etc etc > > > > I'm suggesting that any page that include (manually) cordova.js will have > it dynamically inject installed plugin JS files. Should work fine in a > multi-page app. We don't currently disable plugins on a per-page basis. Is > this really an important use-case? If so, I'm sure we could figure out how > to not inject script tags for plugins you don't want. >
