我将 Ruby 安装在 C:\Ruby200-x64
中,PATH 设置为 C:\Ruby200-x64\bin
并运行:
gem update --system
gem install sass
gem install compass
然后我在 app/config/config.yml
中配置了 Assetic:
ruby: C:\Ruby200-x64\bin\ruby.exe
sass: C:\Ruby200-x64\bin\sass.bat
filters:
compass:
bin: C:\Ruby200-x64\bin\compass.bat
在app/Resources/views/base.html.twig
中,我添加了样式表 block :
{% stylesheets
'css/main.scss' filter="compass" %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
scss 文件指向 /web/css/main.scss
以便在产品中进行测试,我将使用 bundles/bundlename/...
路径。
然后,当我尝试安装和转储 Assets 时:
php app/console assets:install
php app/console assetic:dump
我在以 .bat 结束路径时遇到此错误:
[Assetic\Exception\FilterException]
An error occurred while running:
"C:\Ruby200-x64\bin\ruby.EXE" "C:\Ruby200-x64\bin\compass.bat" "compile" "C:\Users\Jes·s\AppData\Local\Temp" "--config" "C:\Users\Jes·s\AppData\Local\Temp\assC7D6.tmp" "--sass-dir" "" "--css-dir" "" "C:/Users/Jes·s/AppData/Local/Temp/assC7D7.tmp.scss"
Error Output:
C:/Ruby200-x64/bin/compass.bat:1: syntax error, unexpected tCONSTANT, expecting end-of-input
当不使用 .bat 扩展名时:
[Assetic\Exception\FilterException]
An error occurred while running:
"C:\Ruby200-x64\bin\ruby.exe" "C:\Ruby200-x64\bin\compass" "compile" "C:\Users\Jes·s\AppData\Local\Temp" "--config" "C:\Users\Jes·s\AppData\Local\Temp\ass52DB.tmp" "--sass-dir" "" "--css-dir" "" "C:/Users/Jes·s/AppData/Local/Temp/ass52DC.tmp.scss"
Error Output:
Configuration file, C:\Users\Jes·s\AppData\Local\Temp\ass52DB.tmp, not found or not readable.
我看到了这些(和其他):
最佳答案
没有 .bat 的版本是正确的,但看起来“Jes·s”文件夹名称会导致问题(应该有 u 带重音符号?)。
关于symfony - 在 Symfony 2.3.0-DEV 中配置 Assetic、Sass、Compass (Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15677978/