2

recently i download the OpanBay project to host it. As i was trying to edit the layout i found that both nginx and YII were caching css and js files. I tried to disable it from the nginx config but still the css is cached.

What i did:

on the vhost i removed the following lines:

gzip       on;
gzip_comp_level 3;
gzip_types text/plain text/css text/javascript application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss;


location ~ \.(js|css|png|jpg|gif|swf|ico|svg)$ {
    fastcgi_hide_header        Set-Cookie;
    open_file_cache            max=10000 inactive=14d;
    open_file_cache_errors     on;
    open_file_cache_min_uses   3;
    open_file_cache_valid      1m;
    output_buffers             1  2m;

    expires                    14d;
}

on config.php i removed the following lines:

'cache' => array(  
    'class' => 'system.caching.CFileCache'  
), 

But still no luck. I have no idea how the framework works.

1
  • For testing purposes you can try to delete the yii cache (.in the folder ../assets) and then reload the page. This should rebuild the cache with new css and js files. You get the name of the cached directory by viewing the sourcecode of the page in the browser and the looking at the js and css url paths. Commented Dec 20, 2014 at 22:15

2 Answers 2

2

Yii stores its css and js files in a directory called /assets. You can delete this directory and it'll automatically create and generate the files for the next request it receives. http://www.yiiframework.com/wiki/148/understanding-assets/#hh4

But removing the following may cause problems, If it's not handled well in your application.

'cache' => array(  
    'class' => 'system.caching.CFileCache'  
), 
Sign up to request clarification or add additional context in comments.

Comments

0

You can try adding this on your config\main.php or config\web.php

'assetManager' => [
       'appendTimestamp' => true
]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.