我试图在本地安装字形,而不是从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
AsseticFilterLessphpFilter->filterLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php:62
AsseticFilterFilterCollection->filterLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php:90
AsseticAssetBaseAsset->doLoad() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php:65
AsseticAssetFileAsset->load() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php:99
AsseticAssetBaseAsset->dump() at /var/www/blah/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollection.php:151
AsseticAssetAssetCollection->dump() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:222
SymfonyBundleAsseticBundleCommandDumpCommand->doDump() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:162
SymfonyBundleAsseticBundleCommandDumpCommand->dumpAsset() at /var/www/blah/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php:61
SymfonyBundleAsseticBundleCommandDumpCommand->execute() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:244
SymfonyComponentConsoleCommandCommand->run() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:904
SymfonyComponentConsoleApplication->doRunCommand() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
SymfonyComponentConsoleApplication->doRun() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
SymfonyBundleFrameworkBundleConsoleApplication->doRun() at /var/www/blah/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
SymfonyComponentConsoleApplication->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",
}
任何建议将不胜感激!
原来这是 lessphp 中的一个错误: https://github.com/leafo/lessphp/pull/478
目前的解决方案是将 composer.json 中的版本更改为:
"require": {
"leafo/lessphp": "dev-master#85bd4557920d5f4fcbf41beb621e91b842e3621b"
}
但显然这只是暂时的。感谢 freenode 上 #symfony 的米尔卡!
在 github 上查看此报告的错误。看起来最后缺少;
的压缩文件导致了这种行为。一种解决方案是手动添加它。
我建议的解决方案是使用未压缩的文件来防止这种情况,并在您的dev
环境中拥有更多可读的代码。对于prod
环境,文件无论如何都会被资产压缩。
确定我遇到了这个问题,并确定这是因为 Bootstrap LESS 在单独的文件中定义了变量,而 Assetic LESS 编译器不能很好地处理在不同文件中定义的变量。