Minify js not embeed in the html render though caching properly in the cache directory
rafiqbd opened this issue · 8 comments
Minify JS not embed in the html render though caching properly in the cache directory.
CSS and images loading properly.
Using ZF2 latest version and no more module included.
CSS added and working fine. But no more JS include in the view source.
Please show your asset_bundle
config, and your layout file
Thanks dear Neilime for your reply. I think config file is ok that's why js is minified in the cache directory. My problem is js is not including in the header like css. what else i have to do for the css. if you look into this issue it will be great for me. i may send you both file.
thanks
To include js file you have to put this code in your header <head>
:
//Javascript files
echo $this->inlineScript();
For performance reasons it's better to put this code not in the <head>
part but at the bottom of your page (http://developer.yahoo.com/performance/rules.html#js_bottom)
Great dear Neilime! many many thanks for your reply. if you would not mention never found the solution. Also another solution i have got now. I have used Facebook connect so without www it is not working so redirect use for this so taking too high loading time which is mentioned in the yahoo developer documents. But after use asset bundles it will be booster. you may check www.hossbrag.com where i will use asset bundles.
Thanks
It's cool that AssetsBundle works good with your project.
I will mention this point (including js files) in the README file.
Thanks dear Neilime. Last query please if i use one module this is including automatically on others module. is this possible to use only one specific module else need too many files will add in every pages. thanks
As its shown in the README, you can define module specific required assets in your config as following :
return array(
//...
'asset_bundle' => array(
//...
'assets' => array(
//Common assets included in every pages
'css' => array(), //Define css files to include
'js' => array(), //Define js files to include
'less' => array(), //Define less files to include
'media' => array(), //Define images to manage
//Module assets : here are the interresting part for your need
'Test' => => array( // "Test" is the name of the module
'css' => array(), //Define css files to include
'js' => array(), //Define js files to include
'less' => array(), //Define less files to include
)
);
Awesome! Thanks for your all of your help!