Put Assetic back into dynamic mode after complicating

I am using Symfony2 and Assetic. I've been working on CSS a lot lately, so at some point I needed the command

$ php app/console assetic:dump --env=prod --no-debug

      

Since I have used it, I need to run this command every time I change the CSS to see the difference. Now I have done some research and found out that I can put Assetic into view mode so I don't have to run the above command after every change using the following command:

$ php app/console assetic:dump --watch --env=prod

      

However, I just want it to come back before I put it into this manual mode. Symfony2 documentation explains how to make a rescue dump, but not how to get it back into dynamic mode ( http://symfony.com/doc/current/cookbook/assetic/asset_management.html#dumping-asset-files )

Does anyone know how to get it back to dynamic mode?

+3
css symfony assetic


source to share


1 answer


There are two possibilities for Symfony not to dynamically serve assets from an internal controller:

1. assetic.use_controller is not actually true

Please confirm that you are 100% communicating that Symfony assetic.use_controller

is true

. One easy way to debug would be to add this to the start of your controller action and reload the page:

var_dump($this->container->getParameter('assetic.use_controller'));die();

      

Not receiving true

as a return value may mean that you are overriding use_controller

in config_dev.php

or config_prod.php

depending on which environment you specify.



2. Your web server checks for static assets before going to Symfony

Most web servers can be configured to check if a URL points to and delivers a physical file share. Therefore, if you lost assets in Symfony, the web server may serve this file and not pass the request to Symfony.

  • For nginx see: http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
  • For apache see Apache rewrite rule like nginx try_files

The solution is to remove the dumped asset files from the file system. Their location depends on where you set them up, but check web/js

, web/bundles

etc.

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics