Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18430

eZjscore Packer defined per js file and not globally

    XMLWordPrintable

    Details

      Description

      It has been discussed one day on ezjscore forum:
      http://projects.ez.no/ezjscore/forum/general/disable_packer_in_design_ini_frontendjavascriptlist

      I have in fact a lot of javascripts in my design.ini, for example:

      [JavaScriptSettings]
      FrontendJavaScriptList[]=djgfx::js
      FrontendJavaScriptList[]=http://domain.com/remote.js
      FrontendJavaScriptList[]=external-lib.js
      FrontendJavaScriptList[]=custom-javascript.js
      

      And the equivalent in some tpl

      {ezscript_require( array( 'djgfx.js', 'http://domain.com/remote.js', 'external-lib.js', 'custom-javascript.js' ) )}
      

      I run jslint automatically on my .js (djgfx::js and custom-javascript.js) so these both files can be packed at level 3, the maximum

      However, I also use external .js (http://domain.com/remote.js and external-lib.js). Those should only be minified at level 2, as I can't modify them to respect jslint

      As a result, due to the 2 latter, I have to use Packer=2 for all, which is not optimum

      => It would be very nice to use the default Packer settings, but be also possible to define the Packer settings, per file also to have a Packer different than the default Packer

      I could have in my case, in design.ini, something like this:

      [JavaScriptSettings]
      FrontendJavaScriptList[]=3||djgfx::js
      FrontendJavaScriptList[]=http://domain.com/remote.js
      FrontendJavaScriptList[]=external-lib.js
      FrontendJavaScriptList[]=3||custom-javascript.js
      

      and in the .tpl:

      {ezscript_require( array( '3||djgfx.js', 'http://domain.com/remote.js', 'external-lib.js', '3||custom-javascript.js' ) )}
      

      Here, the 3|| could indicate to ezjscore "please use Packer=3 for this file, and not the default Packer".
      And if no || in it, then use the default Packer settings (which is 2)

      All the packer job seems to be done in extension/ezjscore/classes/ezjscpacker.php, via the function packFiles. I guess a patch would concern only this function

        Attachments

          Activity

            People

            Assignee:
            unknown unknown
            Reporter:
            enzo Jerome Despatis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: