Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Can';无法获得正确写入产品图像的许可_Css_Symfony_Rewrite_Assetic - Fatal编程技术网

Css Can';无法获得正确写入产品图像的许可

Css Can';无法获得正确写入产品图像的许可,css,symfony,rewrite,assetic,Css,Symfony,Rewrite,Assetic,使用Symfony和Assetic,我无法在我的prod环境中正确地“转储”css图像。 它们继续链接回web/bundle/…等。。地点 我有一个非常基本的CSSRewite设置: # Assetic Configuration assetic: debug: "%kernel.debug%" use_controller: false filters: cssrewrite: #closure: #

使用Symfony和Assetic,我无法在我的prod环境中正确地“转储”css图像。 它们继续链接回web/bundle/…等。。地点

我有一个非常基本的CSSRewite设置:

# 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"
我的模板:

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

应用程序/控制台资产:安装--symlink

一切似乎都很好

然后我清除prod缓存

应用程序/控制台资产:转储--env=prod

我的css和js复制了预期的文件名,但是我仍然有
url('../../bundle/.etc../images/bg.png')出现在我的css中

在符号链接版本中,css是:
url('../images/bg.png')

所以这一定和阿塞特有关

我希望“转储”css包含url(“../images/bg.png”)等链接

并将图像本身复制到web/images/123abc.png

我应该从assetic那里得到这一点吗?如果是,我做错了什么

提前谢谢

// 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();

app.php的代码与dev和prod的代码相同。这是您想要的吗?对于dev环境symfony2,使用app_dev.php作为前端控制器。对于prod环境symfony2,使用app.php作为前端控制器。为了完整起见,我将重新开始我之前的评论。对于其他读者,请记住CSSRewite在CSS中重写“相对”路径。绝对路径保持不变。有道理。看起来你需要在css中有相对链接,否则assetic不会重写图像。有人能证实这是否是我所期望的吗?我已经审阅了文档,事实上它确实说明了这一点。我真的在为自己没有早点看到这件事而自责。
//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();