Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36312

Most of our yui_module calls don't list dependencies

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not a bug
    • 2.3.2
    • None
    • JavaScript
    • MOODLE_23_STABLE

    Description

      At present, most of our calls to yui_module just list the individual module that we require. As a result, the browser goes away and fetches just that module.
      When it's finished parsing that module, it includes all of the dependencies we didn't list and fetches those.
      It may be that those dependencies have yet more additional dependencies and it needs to fix those.

      This obviously has a minor performance hit and it would be great if we could address this.

      There are a couple of ways we can fix this:

      • include the dependencies when we call yui_module()
      • include the dependencies in the YUI_config so that the YUI loader works this out automatically

      The first option is easy and we can easily get it in place before 2.4
      The second option is much harder and needs more consideration.

      I propose that we initially call yui_module with all of the dependencies, and then for 2.5 we consider how best we can define our dependencies such that the YUI loader does the Right Thing.

      It may be that we consider using the YUI shifter system (http://www.yuiblog.com/blog/2012/08/27/shifter-fast-yui-module-building/) in some fashion to define the dependencies once in a separate file, minify the JS, and pass it through jshint (jslint). This would be ideal, but shifter may requires us to modify how we structure our file loading and creation, and has potential implications for development - e.g. an additional stage at deploy time.

      Attachments

        Activity

          People

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: