使用Symfony和Assetic,我无法在我的产品环境中正确'转储'。他们继续链接回Web/Bundle/...等。位置。
我有一个非常基本的CSSsrewrite设置:
# 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 %}
我有debug false的app.php的产品版本:
use SymfonyComponentClassLoaderApcClassLoader;
use SymfonyComponentHttpFoundationRequest;
$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);
我已经完成了:
应用程序/控制台资产:安装-Symlink
一切似乎都很好
然后我清除产品缓存
确定
App/Console Assetic:dump -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
我应该期望这是从资产中的,如果是这样,我做错了什么?
谢谢。
// 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();