0

我试图在本地安装字形图标,而不是从 CDN 中提取(由于我没有调查的原因,CDN 已停止显示它们)。现在运行assetic:dump会导致异常,我不知道如何修复:

me@server:/var/www/blah$ php app/console assetic:dump -vvv
Dumping all dev assets.
Debug mode is on.

20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular.eot
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.eot
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular_glyphicons-halflings-regular_1.eot
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.eot
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular.svg
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.svg
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular_glyphicons-halflings-regular_1.svg
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.svg
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular.ttf
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.ttf
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular_glyphicons-halflings-regular_1.ttf
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.ttf
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular.woff
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.woff
20:26:32 [file+] /var/www/blah/app/../web/fonts/glyphicons-halflings-regular_glyphicons-halflings-regular_1.woff
        /var/www/blah/app/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.woff
20:26:32 [file+] /var/www/blah/app/../web/css/bootstrap.css
        /var/www/blah/app/../vendor/twbs/bootstrap/less/bootstrap.less

  [Exception]
  .pull-right is undefined: line: 60

Exception trace:
 () at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:3465
 lessc_parser->throwError() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:2008
 lessc->throwError() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:685
 lessc->compileProp() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:282
 lessc->compileProps() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:220
 lessc->compileCSSBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:194
 lessc->compileBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:656
 lessc->compileProp() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:282
 lessc->compileProps() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:220
 lessc->compileCSSBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:194
 lessc->compileBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:656
 lessc->compileProp() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:282
 lessc->compileProps() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:235
 lessc->compileMedia() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:197
 lessc->compileBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:656
 lessc->compileProp() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:160
 lessc->compileImportedProps() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:766
 lessc->compileProp() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:282
 lessc->compileProps() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:276
 lessc->compileRoot() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:191
 lessc->compileBlock() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:1810
 lessc->compile() at /var/www/blah/vendor/leafo/lessphp/lessc.inc.php:1937
 lessc->parse() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php:104
 Assetic\Filter\LessphpFilter->filterLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php:62
 Assetic\Filter\FilterCollection->filterLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php:90
 Assetic\Asset\BaseAsset->doLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php:65
 Assetic\Asset\FileAsset->load() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php:99
 Assetic\Asset\BaseAsset->dump() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollection.php:151
 Assetic\Asset\AssetCollection->dump() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:222
 Symfony\Bundle\AsseticBundle\Command\DumpCommand->doDump() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:162
 Symfony\Bundle\AsseticBundle\Command\DumpCommand->dumpAsset() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:61
 Symfony\Bundle\AsseticBundle\Command\DumpCommand->execute() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:904
 Symfony\Component\Console\Application->doRunCommand() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at /var/www/blah/app/console:27

assetic:dump [--watch] [--force] [--period="..."] [write_to]

config.yml 包括:

assetic:
    debug:          %kernel.debug%
    use_controller: false
    filters:
        cssrewrite: ~

        lessphp:
            apply_to: "\.less$"
            file:     "%kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php"
    assets:
        fonts_glyphicons_eot:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.eot"
            output: "fonts/glyphicons-halflings-regular.eot"
        fonts_glyphicons_svg:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.svg"
            output: "fonts/glyphicons-halflings-regular.svg"
        fonts_glyphicons_ttf:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.ttf"
            output: "fonts/glyphicons-halflings-regular.ttf"
        fonts_glyphicons_woff:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.woff"
            output: "fonts/glyphicons-halflings-regular.woff"
        css_bootstrap:
            inputs:
                -  "%kernel.root_dir%/../vendor/twbs/bootstrap/less/bootstrap.less"
            output: "css/bootstrap.css"
            filters:
                - lessphp
        js_bootstrap:
            inputs:
                -  "%kernel.root_dir%/../vendor/twbs/bootstrap/js/*.js"
            output: "js/bootstrap.js"

composer.json 包括:

"require": {
    "twbs/bootstrap": "v3.0.0",
    "components/jquery": "1.10.2",
    "leafo/lessphp": "0.4.*@dev",
}

任何意见是极大的赞赏!

4

3 回答 3

5

原来这是lessphp中的一个错误:https ://github.com/leafo/lessphp/pull/478

目前解决方案是将composer.json中的版本更改为:

"require": {
    "leafo/lessphp": "dev-master#85bd4557920d5f4fcbf41beb621e91b842e3621b"
}

但显然这只是暂时的。感谢 freenode 上#symfony 中的milka!

于 2013-09-27T23:17:55.947 回答
0

我很确定我遇到了这个问题,并确定这是因为 Bootstrap LESS 在单独的文件中定义了变量,而 Assetic LESS 编译器不能很好地处理在不同文件中定义的变量。

于 2013-09-27T20:33:28.033 回答
0

在github上查看这个报告的错误。看起来;最后缺少的压缩文件导致了这种行为。一种解决方案是手动添加它。

我建议的解决方案是使用未压缩的文件来防止这种情况,并且在您的dev环境中也有更多可读的代码。对于prod环境,文件无论如何都会被资产压缩。

于 2013-09-27T20:33:36.363 回答