问题
I am getting a 500 error when compiling scss files with assetic. Strangely enough, using php app/console assetic:dump
the scss compiles without issue. Resources in web/bundles
are relative symlinks.
I'm running OSX 10.8, symfony 2.3, and php 5.4.20.
config.yml
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
filters:
cssrewrite: ~
sass:
apply_to: "\.scss$"
base.html.twig
{# ... #}
{% stylesheets
filter='cssrewrite'
'bundles/acmehello/css/main.css'
'bundles/acmehello/scss/page.scss'
%}
<link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %}
{# ... #}
回答1:
The issue was the fact that I am using rvm, which causes issues with sass paths (thanks to this SO answer).
To solve this, I generated an rvm gemset with:
# will create 'php_sass' and 'php_compass' executables in $GEM_HOME
rvm wrapper ruby-1.9.3-p194 php sass compass
And added the following to my config.yml file:
assetic:
debug: %kernel.debug%
use_controller: true
bundles: [ ]
filters:
cssrewrite: ~
scss:
sass: /Users/Nick/.rvm/bin/php_sass
apply_to: "\.scss$"
SCSS files now compile just fine. Compass users will need to point assetic to the gemset for compass
来源:https://stackoverflow.com/questions/19411311/500-error-when-compiling-scss-in-symfony2