Symfony2, Loading CSS Files Without Cache

Symfony2, loading css files without cache

Problem was.... Uhm, don't even know in what but.
Current config.yml and console commands done their job. (means that what ever i change in css it will shows as "online mode" in browser)

assets:install web --symlink
assetic:dump web

parts from config.yml

# Twig Configuration
twig:
cache: false

# Assetic Configuration
assetic:
assets:
default_css:
inputs:
- '%kernel.root_dir%/Resources/public/css/default.css'

debug: "%kernel.debug%"
use_controller: true
bundles: []
#java: /usr/bin/java
filters:
cssrewrite: ~

Also helps (maybe, don't know)

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information

umask(0000);

In twig it looks like this

{% stylesheets "@default_css" filter="cssrewrite" %}
<link href="{{ asset_url }}" type="text/css" media="all" rel="stylesheet" />
{% endstylesheets %}

With this params I can create\edit\delete any data from css and it would be show in browser immediately.

PS: I showed code "not common", other settings in config.yml i think the same as base one.

Changes on CSS file not loading

I was clearing the cache for production mode. Solved with the next command:

php app/console cache:clear --env=dev --no-debug

How to make Symfony2 to load CSS, JS files directly and not via PHP?

Try to remove this part of code in routing_dev.yml when use_controller is false :

_assetic:
resource: .
type: assetic

Static assets not refreshing with symfony2 clear cache command

I think I've found the answer here:

assetic compass filter, css not updating when changing imported file (google groups discussion)

It seems that if a change is made to an imported file without any changes to the parent file then the parent file will not be recompiled. The result being the change will not be seen until you force recompilation.

The poster on google groups suggested a possible fix (hack!) by editing the AsseticController. I haven't tried it yet, but even if it works I'd rather not edit a vendor package.



Related Topics



Leave a reply



Submit