Unable to fall asleep to draw cssrewrite images correctly

Using Symfony and Assetic I can't get css images to "dump" correctly in my prod environment. They continue to refer to the location of web / bundle / ... etc.

I have a very simple cssrewrite installation:

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    filters:
        cssrewrite:
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

My template:

{% stylesheets 'bundles/<my bundle>/css/style.css' filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}

I have a prod version of app.php version with debug false:

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$apcLoader = new ApcClassLoader('sf2', $loader);
$loader->unregister();
$apcLoader->register(true);
*/

require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);

// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

I did:

application / console assets: install --symlink

Everything seems beautiful

Then I clear the prod cache

Ok

app / console assetic: dump --env = prod

My css and js are copied with the expected file names, however I still have url('../../bundle/..etc../images/bg.png');one appearing in my css

In the symbolic version of css: url('../images/bg.png');

So this must be something to do with the ascetic.

, , , 'dump'ed css , url ​​('../images/bg.png ');

, web/images/123abc.png

, , , ?

, .

+3
1
// In Config.yml file 

# Assetic Configuration 
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]

app.php

//If it is in dev environment In your app_dev.php file contain like this
$kernel = new AppKernel('prod', true);
$kernel->loadClassCache();

// If it is in prod environment, In your app.php file contain like this 
$kernel = new AppKernel('prod', true);
$kernel->loadClassCache();
+1

All Articles