简体   繁体   English

symfony2:kernel.debug始终为false

[英]symfony2 : kernel.debug is always false

I use assetic to bundle css and js files together and I've noticed that even in debug mode they are bundled. 我使用资产式将css和js文件捆绑在一起,并且我注意到即使在调试模式下,它们也会捆绑在一起。 That should only happen when kernel.debug is false. 只有当kernel.debug为false时,才会发生这种情况。

So I've tried the following: 因此,我尝试了以下方法:

original : 原版的 :

 assetic:
   debug:         %kernel.debug%

force to false: 强制为假:

 assetic:
   debug:         false

force to true : 强制为true:

 assetic:
  debug:         true

When I force to false, files are bundled. 当我强制为false时,文件将捆绑在一起。 When I force true, files are not bundled. 当我强制为true时,文件不会捆绑在一起。 When I leave %kernel.debug%, files are bundled. 当我离开%kernel.debug%时,文件被捆绑。

Why is %kernel.debug% equals to false even though in app_dev I've set it to true: 为什么%kernel.debug%等于false,即使在app_dev中我将其设置为true:

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

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

 $kernel = new AppKernel('dev', true);

EDIT 编辑

assetic:
debug:         %kernel.debug%
use_controller: false
bundles:        [ ]
#java: /usr/bin/java
filters:
    cssrewrite: ~
    uglifyjs2:  
        bin: /usr/bin/uglifyjs
        apply_to: "\.js$"      
    uglifycss:
        bin: /usr/bin/uglifycss
        apply_to: "\.css$"    

I guess youre trying to to dump assets using the assetic:dump command. 我猜您正在尝试使用assetic:dump命令转储资产。

In order to avoid the creation of debug files add --no-debug to the command. 为了避免创建调试文件,请在命令中添加--no-debug

you could further execute the command explicitly within the production environment adding --env=prod . 您可以在生产环境中添加--env=prod进一步明确地执行命令。 So finally ... 所以最后...

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

... will not create the debug files. ...将不会创建调试文件。

Please note that --no-debug does not work in combination with --watch . 请注意, --no-debug --watch --no-debug不能与--watch结合使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM