Yii Framework Forum: [EXTENSION] minScript - Yii Framework Forum

Jump to content

  • (7 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] minScript combine, minify, compress, cache Rate Topic: ***** 2 Votes

#81 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 28 November 2012 - 09:43 AM

filemtime returns false because one of the files was probably not found in which case groupsConfig.php throws an exception.

to find out which files cause this problem, have a look inside your yii application log. minScript logs any errors in there. can you please post the minScript log messages here so i can have a look?

View PostMewsicLovr, on 19 November 2012 - 11:28 PM, said:

I traced it to some kind of problem with filemtime which is returning false in IIS and so groupsConfig.php throws an internal server error. Not sure why filemtime returns false.

0

#82 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 28 November 2012 - 10:25 AM

Hey Fábio

thank you very much!

Looks like Galleria doesn't behave good when combined into one file. To fix this temporarily, include following file manually in your view:
/assets/themes/classic/galleria.classic.min.js

There will be a new function in the next minScript version which will allow you to exclude certain files from being processed.

View PostFábio Felicidade, on 20 November 2012 - 02:22 PM, said:

Hi,

Gratz on great extension, really improve overall performance on site.
But in my project, I'm using yii galleria extension and when including minScript extension, galleria doesn't render. in my page test, the images show briefly on load, without the galleria, and disappear after. No errors showing in firebug and looking at source code the galleria scripts are included. I'm using several other yii extensions and no problem came up. Egmap and tinymce as example, rendered ok.
Can't find what the problem is. Hope you can help.

Thank you.

0

#83 User is offline   Arivan Bastos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 14-November 12

Posted 29 November 2012 - 03:25 PM

Hi,

Nice extension, but I'm facing problems with CSS images. My project uses Bootstrap framework which provides a icon set and classes to use that icons. When I turn on the minScript extension the images are not displayed. Looking the generated css code I found:

- minScript OFF: background-image: url("../img/glyphicons-halflings.png");
- minscript ON: background-image: url("/myproject/protected/extensions/bootstrap/assets/img/glyphicons-halflings.png");


The same happens with the header background image of the default GridView componente:

- minScript OFF: background: url("bg.gif") repeat-x scroll left top white;
- minscript ON: background: url("/yii/framework/zii/widgets/assets/gridview/bg.gif") repeat-x scroll left top white;

Is this a expected behavior? The folders generated by minScript are denied by Yii .htaccess file. What am I doing wrong?

Thank u.
0

#84 User is offline   jiaming 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 262
  • Joined: 10-April 12

Posted 05 December 2012 - 01:26 AM

Hi, thanks for this great extension, but it's not working in my case.

For some reasons that 2 serve.js are generated. They are not same but keeps giving me errors like
TypeError: jQuery(...).tooltip is not a function
	

jQuery('a[rel="tooltip"]').tooltip();


Here is my config...anything wrong?

Thanks so much for this!

        'controllerMap'=>array(
                'min'=>array(
                        'class'=>'ext.minScript.controllers.ExtMinScriptController',
                ),
        ),

And in components:

'clientScript'=>array(

 'class'=>'ext.minScript.components.ExtMinScript',

  'packages'=>array(
    'jquery'=>array(
      'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1.8/',
      'js'=>array('jquery.min.js'),
      'coreScriptPosition'=>CClientScript::POS_HEAD
    ),
    'jquery.ui'=>array(
      'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jqueryui/1.8/',
      'js'=>array('jquery-ui.min.js'),
      'depends'=>array('jquery'),
      'coreScriptPosition'=>CClientScript::POS_BEGIN
    ),
  ),
),

0

#85 User is offline   smith19 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 26-November 12

Posted 05 December 2012 - 08:41 AM

I am new to yii framework. I have around 40 js files which i need to compress to one file and send it to the browser. I read the documentation but not able to figure out how to make it work.
I have saved the extension in the extension directory and then loaded in the main config file.
  • Where should i list all the files that i want to compress.
  • I want compressed file to be loaded in the index page.
  • Where should i call the link to the compressed file.
Also what is the path to the compressed file.

Thanks
0

#86 User is offline   smith19 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 26-November 12

Posted 05 December 2012 - 03:09 PM

I tried running it and i get the error
ExtMinScript and its behaviors do not have a method or closure named "generateScriptMap".
0

#87 User is offline   hemc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 84
  • Joined: 09-July 12
  • Location:New Delhi

Posted 14 December 2012 - 03:06 AM

Hi
i have installed it but java script files are not being included .when i check in firebug found that
"http://www.localhost.com/min/serve?g=02a1bfe6f7562e56a93f904e6bc16043" 500 exception.
can anybody guide me what is the thing that i am missing.
thanks in advance.

edit-
i have checked that it is reaching to actionServe() but not ahead.


edit->
Yii::app()->clientScript->minScriptCreateGroup()
works for me.
but i have two problems
1.why this not worked ?
Yii::app()->clientScript->registerScriptFile();

2.why i getting 2 serve.js and both have different content?
Please guide me .
Please don't add a reply to say thanks, There is already a +1 button to do same.
0

#88 User is offline   jplozgom 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 05-January 13

Posted 05 January 2013 - 05:18 PM

Hi, I've been trying to use minScript but I keep getting the following error

[error] [ext.minScript.controllers.ExtMinScriptController] The minScript group "358d79a5cf693a981f43c4af0f098600" could not be served because some files are inaccessible.

the log says

[error] [ext.minScript.components.ExtMinScript] Can't access /restrepo_y_uribe/css/frontend/home.css
[error] [ext.minScript.components.ExtMinScript] Can't access /restrepo_y_uribe/css/frontend/style.css

any ideas? thanks
0

#89 User is offline   khaperey 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 01-July 10
  • Location:Quebec

Posted 27 January 2013 - 06:27 PM

Hi,

I'm trying to configure this extension and can't make it in working as my codes are here step by step.

in config/main.php file

  'components'=>array(
        'minScript'=>array(
                'class'=>'ext.minScript.components.ExtMinScript',
                'groupMap'=>array(
                'js'=>array(
                        'path-to-js-file/static/js/jquery-1.8.3.min.js',
			'path-to-js-file/static/js/bjqs-1.3.min.js',
                ),
                ),
        ),
   ),


And in Head section of main index.html I have this..

Yii::app()->minScript->generateScriptMap('js');


When I run my application I get this ERROR...

Property "ExtMinScript.groupMap" is not defined. 


Any idea where Im doing some thing wrong?

An earlier reply will highly be appreciated,
0

#90 User is offline   maitvn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 01-January 13

Posted 09 March 2013 - 12:16 PM

Hi,

I'm new to Yii so I installed minScript successfully and it works well. But I want to minify the CSS/script only in production version. Because it might be easier to develop the website.
My question is How do I disable minScript extension in development version?

Thanks In Advance !
0

#91 User is offline   manoak 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 13-June 11

Posted 20 March 2013 - 02:29 AM

View Postmaitvn, on 09 March 2013 - 12:16 PM, said:

Hi,

I'm new to Yii so I installed minScript successfully and it works well. But I want to minify the CSS/script only in production version. Because it might be easier to develop the website.
My question is How do I disable minScript extension in development version?

Thanks In Advance !


You can set minScriptDebug to true in your development version settings.
or you can just specify default clientScript component in your dev application config (main.php).
0

#92 User is offline   manoak 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 13-June 11

Posted 20 March 2013 - 02:41 AM

Hi,

In our web application we have continous integration. So new version deployment is controlled by utilities in which we can make system tasks. In this application we have lots of scripts, they can be, and mostly is, dynamic per controller, so when min script minifies for the first time it does its job quite long (2-5 seconds). That's normal I think, but the question is about minScriptLmCache. It is not possible to do unlimited cache, so I'm thinking about setting value to some week or month, to minscript hold it in cache for a long period. I've set cache to CMemCache and after new version deployment I'm clearing memcache. So is this strategy correct, or it could have some unexpected issues?
Maybe its better to keep cache in APC (I clear apc cache on deployment too)?

And one more question: In this app we have two JS files who are generated by controllers. Simply there are dynamic info (based on locale) and we pass data from php to js in a such way. Of course js minifier cannot find these files and dies, as they are /index.php?r=module/main/locale&locale=en in such form. What can you suggest at such situations? Also, this file needs to be included at certain position, so minified js file could get variables from this script.
0

#93 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 03:02 PM

Hey Arivan Bastos

I tried to reproduce the described problem with the default GridView component but the URLs inside the CSS files were all good. Now, the default Yii behavior would be to publish all the required files as assets in which case everything should just work automatically. Did you change something regarding that behavior? Are your CSS files inside a symlinked directory?

View PostArivan Bastos, on 29 November 2012 - 03:25 PM, said:

Hi,

Nice extension, but I'm facing problems with CSS images. My project uses Bootstrap framework which provides a icon set and classes to use that icons. When I turn on the minScript extension the images are not displayed. Looking the generated css code I found:

- minScript OFF: background-image: url("../img/glyphicons-halflings.png");
- minscript ON: background-image: url("/myproject/protected/extensions/bootstrap/assets/img/glyphicons-halflings.png");


The same happens with the header background image of the default GridView componente:

- minScript OFF: background: url("bg.gif") repeat-x scroll left top white;
- minscript ON: background: url("/yii/framework/zii/widgets/assets/gridview/bg.gif") repeat-x scroll left top white;

Is this a expected behavior? The folders generated by minScript are denied by Yii .htaccess file. What am I doing wrong?

Thank u.

0

#94 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 03:05 PM

Hey jiaming

I tried the configuration you provided and it works flawlessly for me. Are you using the latest version of minScript (2.2)?


View Postjiaming, on 05 December 2012 - 01:26 AM, said:

Hi, thanks for this great extension, but it's not working in my case.

For some reasons that 2 serve.js are generated. They are not same but keeps giving me errors like
TypeError: jQuery(...).tooltip is not a function
	

jQuery('a[rel="tooltip"]').tooltip();


Here is my config...anything wrong?

Thanks so much for this!

        'controllerMap'=>array(
                'min'=>array(
                        'class'=>'ext.minScript.controllers.ExtMinScriptController',
                ),
        ),

And in components:

'clientScript'=>array(

 'class'=>'ext.minScript.components.ExtMinScript',

  'packages'=>array(
    'jquery'=>array(
      'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1.8/',
      'js'=>array('jquery.min.js'),
      'coreScriptPosition'=>CClientScript::POS_HEAD
    ),
    'jquery.ui'=>array(
      'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jqueryui/1.8/',
      'js'=>array('jquery-ui.min.js'),
      'depends'=>array('jquery'),
      'coreScriptPosition'=>CClientScript::POS_BEGIN
    ),
  ),
),


0

#95 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 03:33 PM

1. You don't have to explicitly list any files. All files registered with CClientScript (Yii::app() -> clientScript -> registerScriptFile() and Yii::app() -> clientScript -> registerCssFile()) are automatically compressed, combined and minified.
2. You need to register the files either inside you view files (http://www.yiiframew.../en/basics.view) for your index page or inside the action for your index page (http://www.yiiframew...ntroller#action) depending on what you are using and in which context
3. There won't be a compressed file, everything is taken care of for you when you use registerScriptFile()/registerCssFile()

View Postsmith19, on 05 December 2012 - 08:41 AM, said:

I am new to yii framework. I have around 40 js files which i need to compress to one file and send it to the browser. I read the documentation but not able to figure out how to make it work.
I have saved the extension in the extension directory and then loaded in the main config file.
  • Where should i list all the files that i want to compress.
  • I want compressed file to be loaded in the index page.
  • Where should i call the link to the compressed file.
Also what is the path to the compressed file.

Thanks

0

#96 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 03:36 PM

you are trying to use old minScript methods which were available before version 2.0 but are not anymore in the newest version. please read the wiki page which has new usage examples

View Postsmith19, on 05 December 2012 - 03:09 PM, said:

I tried running it and i get the error
ExtMinScript and its behaviors do not have a method or closure named "generateScriptMap".

0

#97 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 05:00 PM

Hey hemc

500 errors are usually a sign of wrong URLs/paths passed to minScript. please check your yii application log for further information on what is going on, any minScript errors will be logged there.

1. please do as advised above to check why registerScriptFile() is not working
2. if you are using minScriptCreateGroup() multiple times it will create multiple groups. are you passing an array of multiple file paths to minScriptCreateGroup()?

View Posthemc, on 14 December 2012 - 03:06 AM, said:

Hi
i have installed it but java script files are not being included .when i check in firebug found that
"http://www.localhost.com/min/serve?g=02a1bfe6f7562e56a93f904e6bc16043" 500 exception.
can anybody guide me what is the thing that i am missing.
thanks in advance.

edit-
i have checked that it is reaching to actionServe() but not ahead.


edit->
Yii::app()->clientScript->minScriptCreateGroup()
works for me.
but i have two problems
1.why this not worked ?
Yii::app()->clientScript->registerScriptFile();

2.why i getting 2 serve.js and both have different content?
Please guide me .

0

#98 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 05:06 PM

most likely, you are passing wrong paths to minScriptCreateGroup() or wrong URLs to Yii::app()->clientScript->registerCssFile()

please check that those are correct: minScriptCreateGroup() needs file system paths while registerCssFile() needs correct URLs

View Postjplozgom, on 05 January 2013 - 05:18 PM, said:

Hi, I've been trying to use minScript but I keep getting the following error

[error] [ext.minScript.controllers.ExtMinScriptController] The minScript group "358d79a5cf693a981f43c4af0f098600" could not be served because some files are inaccessible.

the log says

[error] [ext.minScript.components.ExtMinScript] Can't access /restrepo_y_uribe/css/frontend/home.css
[error] [ext.minScript.components.ExtMinScript] Can't access /restrepo_y_uribe/css/frontend/style.css

any ideas? thanks

0

#99 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 05:09 PM

you are using an old configuration with a newer minScript version. Please read the wiki page for configuration and usage instructions.

View Postkhaperey, on 27 January 2013 - 06:27 PM, said:

Hi,

I'm trying to configure this extension and can't make it in working as my codes are here step by step.

in config/main.php file

  'components'=>array(
        'minScript'=>array(
                'class'=>'ext.minScript.components.ExtMinScript',
                'groupMap'=>array(
                'js'=>array(
                        'path-to-js-file/static/js/jquery-1.8.3.min.js',
			'path-to-js-file/static/js/bjqs-1.3.min.js',
                ),
                ),
        ),
   ),


And in Head section of main index.html I have this..

Yii::app()->minScript->generateScriptMap('js');


When I run my application I get this ERROR...

Property "ExtMinScript.groupMap" is not defined. 


Any idea where Im doing some thing wrong?

An earlier reply will highly be appreciated,

0

#100 User is offline   limitless 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 120
  • Joined: 22-July 11

Posted 22 May 2013 - 06:15 PM

The 2-5 second delay you see on initial page load is normal since minScript generates all the content and then caches it.

minScriptLmCache does not control how long minScript output is cached but rather how long last modified timestamps of files should be cached. While this is all connected, the output cache should not expire until one of the files changes. So while yes, you could set minScriptLmCache to a very high number, you should not have to since the output cache will only be recreated if one of the files changes.

You can use both, MemCache or APC, neither is better than the other when it comes to minScript caching.

handling of dynamic content has been a topic for a while, but as of right now there is no way to process dynamic content with minScript. Since minScript caches everything, depending on how dynamic the content is, it would not work very well anyways. I suggest you just exclude the dynamic files in minScript by using ExtMinScript::$minScriptUrlMap (this is a new feature in version 2.2, you can find more infos here: https://bitbucket.or...i/Configuration)

let me know if you have any more questions...

View Postmanoak, on 20 March 2013 - 02:41 AM, said:

Hi,

In our web application we have continous integration. So new version deployment is controlled by utilities in which we can make system tasks. In this application we have lots of scripts, they can be, and mostly is, dynamic per controller, so when min script minifies for the first time it does its job quite long (2-5 seconds). That's normal I think, but the question is about minScriptLmCache. It is not possible to do unlimited cache, so I'm thinking about setting value to some week or month, to minscript hold it in cache for a long period. I've set cache to CMemCache and after new version deployment I'm clearing memcache. So is this strategy correct, or it could have some unexpected issues?
Maybe its better to keep cache in APC (I clear apc cache on deployment too)?

And one more question: In this app we have two JS files who are generated by controllers. Simply there are dynamic info (based on locale) and we pass data from php to js in a such way. Of course js minifier cannot find these files and dies, as they are /index.php?r=module/main/locale&locale=en in such form. What can you suggest at such situations? Also, this file needs to be included at certain position, so minified js file could get variables from this script.

0

Share this topic:


  • (7 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users