developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 8 years ago

Closed 7 years ago

#1461 closed bug (fixed)

minify and jquery.min.js

Reported by: foxmask Owned by:
Priority: normal Milestone: Jelix 1.3.6
Component: jelix:plugins:response Version: 1.3.1
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Here is what i did :

in the defaultconfig.ini.php

minifyJS=on
minifyExcludeJS="jquery.min.js"

in my main.tpl template

{meta_html js $j_jelixwww.'jquery/jquery.min.js'}
{meta_html js $j_basepath.'bootstrap/js/bootstrap.min.js'}
{meta_html js $j_basepath.'bootstrap/js/bootstrap-collapse.js'}
{meta_html js $j_basepath.'bootstrap/js/bootstrap-modal.js'}
{meta_html js $j_basepath.'bootstrap/js/bootstrap-tooltip.js'}

Then when I access to my main page I have a JS error from the FireBug? Console

$ is not defined
$(document).ready(function(){

the 2nd line comes from my main.tpl

for the first line it looks like that minify tries to minify jquery.min.js even with the excludes rule i set.

Change History (7)

comment:1 Changed 8 years ago by foxmask

the only way to make the template works is to set minifyJS to off

comment:2 Changed 8 years ago by laurentj

  • Component changed from jelix to jelix:plugins:response
  • Milestone set to Jelix 1.3.3
  • Status changed from new to confirmed

comment:3 Changed 8 years ago by bricet

First, using minify _should_ never break your code. So if minifying works fine (not even talking about exclusion), you should not have to change anything in your code (nor excluding any file from minification). So I suspect the minification did not actually work at all in your test (activating "network errors" in Firebug is a good idea to see that easily, IMHO).

Second, the minifyExcludeJS does not list the files excluded but the pathes (from your www) to the files excluded (actually, you should even include your alias in it, which is quite dirty and should be enhanced). The idea behind this is that you may have several different JS files having the same names but located in different pathes and get a distinct exclusion setting for them.

comment:4 Changed 8 years ago by laurentj

  • Status changed from confirmed to new

Did you check the generated <script>? And did you load the url in your browser to see what are the contents of generated files?

comment:5 Changed 7 years ago by laurentj

  • Milestone set to Jelix 1.3.6

comment:6 Changed 7 years ago by laurentj

  • Status changed from new to confirmed

There are two issue here.

First is comming from you. You must indicate the path of the file, not the file alone. I improved the documentation to indicate this issue.

Second is comming from Jelix : the path should be absolute. This is not very friendly. I made a little improvement to allow to indicate path relative to the basePath.

https://github.com/jelix/jelix/commit/1b18453de27f89b85aba9904a488024799832270

comment:7 Changed 7 years ago by laurentj

  • Resolution set to fixed
  • Status changed from confirmed to closed
Note: See TracTickets for help on using tickets.