Moodle
  1. Moodle
  2. MDL-26315

Added theme javascript causes minify to fail completely

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not a bug
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Performance, Themes
    • Labels:
      None
    • Environment:
      LAMP
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      15911

      Description

      When adding a javascript file via a theme config, a line like (this is jquery):

      if (href.search(/^[^:/]:\/\/[^/]\/?/) == -1){

      }

      causes the javascript minifier (called in /moodle2/theme/javascript.php) to fail completely and not write any javascript to the cache. This does not happen if cache is turned off (i.e., in theme designer mode). Only occurs when theme cache is turned on.

      Perhaps a temporary fix would be to test if the minified js was written to the cache (in javascript.php) and, if not, send the uncached files.

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          I do not understand, could you please upload a full theme example that demonstrates the problem?

          Show
          Petr Škoda added a comment - I do not understand, could you please upload a full theme example that demonstrates the problem?
          Hide
          John Stabinger added a comment -

          Attached is a simple example. When the theme is in theme designer mode, the included js works fine (simply alerts some text).

          When theme designer mode is turned off, and the cache is cleared, the included js no longer works and when you look in the cache (in the moodle data folder) you can see that nothing is being written to the cahced js files...

          Show
          John Stabinger added a comment - Attached is a simple example. When the theme is in theme designer mode, the included js works fine (simply alerts some text). When theme designer mode is turned off, and the cache is cleared, the included js no longer works and when you look in the cache (in the moodle data folder) you can see that nothing is being written to the cahced js files...
          Hide
          Petr Škoda added a comment -

          hmm, I agree with the minify script, your regex does not seem to be valid, the following works fine for me:
          (href.search(/^[^:\/]:\/\/[^\/]\/?/) == -1){

          Show
          Petr Škoda added a comment - hmm, I agree with the minify script, your regex does not seem to be valid, the following works fine for me: (href.search(/^ [^:\/] :\/\/ [^\/] \/?/) == -1){

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: