neilime / zf2-assets-bundle

AssetsBundle is a module for Zend Framework 2 allowing asset managment (bundling & caching)
https://neilime.github.io/zf2-assets-bundle/
MIT License
33 stars 20 forks source link

Minify js not embeed in the html render though caching properly in the cache directory #11

Closed rafiqbd closed 11 years ago

rafiqbd commented 11 years ago

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.

neilime commented 11 years ago

Please show your asset_bundle config, and your layout file

rafiqbd commented 11 years ago

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

neilime commented 11 years ago

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)

rafiqbd commented 11 years ago

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

neilime commented 11 years ago

It's cool that AssetsBundle works good with your project. I will mention this point (including js files) in the README file.

rafiqbd commented 11 years ago

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

neilime commented 11 years ago

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
               )
        );
rafiqbd commented 11 years ago

Awesome! Thanks for your all of your help!