Actually, this is two questions:
-
What is the correct way to use the SCSS filter in my Symfony project in Windows (in Twig templates) ?
I mean, how do i use the scss binary in windows? -
Also, Do I necessarily need to use Compass? and “HOW” do i use compass if I have installed it?
Extension : Here is some configuration I have done:
In app/config/config.yml
assetic:
debug: %kernel.debug%
use_controller: false
filters:
scss:
bin: "%kernel.root_dir%/Resources/libs/scss"
compass:
bin: "%kernel.root_dir%/Resources/libs/compass"
In my twig file:
{% stylesheets
'@PlaylyfeBaseBundle/Resources/public/css/base.scss'
'@PlaylyfeBaseBundle/Resources/public/css/another.scss'
filter='scss'
output='css/compiled/total.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
But, when i load the page, I get the following error (inside the css file)
[exception] 500 | Internal Server Error | RuntimeException
[message] The filename, directory name, or volume label syntax is incorrect.
[1] RuntimeException: The filename, directory name, or volume label syntax is incorrect.
at n/a
in C:\wamp\www\Symfony\vendor\assetic\src\Assetic\Filter\Sass\SassFilter.php line 162
at Assetic\Filter\Sass\SassFilter->filterLoad(object(Assetic\Asset\FileAsset))
in C:\wamp\www\Symfony\vendor\assetic\src\Assetic\Filter\FilterCollection.php line 62
at Assetic\Filter\FilterCollection->filterLoad(object(Assetic\Asset\FileAsset))
in C:\wamp\www\Symfony\vendor\assetic\src\Assetic\Asset\BaseAsset.php line 83
at Assetic\Asset\BaseAsset->doLoad('
I can only speak for Compass since is what I use but the same issues/problems most likely relate to the SASS/SCSS filters as well.
There are many known file path issues with Compass on Windows systems:
… and also fixes proposed to Assetic to deal with them:
I’ve found that doing the following was necessary for everything to work together…
#1. Make sure
%ruby%\binis in your environmentPATHvariable:Example:
PATH = "...;C:\Ruby\1.9.2\bin"#2. Edit
%ruby%\bin\compass.batto use absolute paths:#3. Revert 539f206 manually in
compiler.rb@ line ~10:Path:
%ruby%\lib\ruby\gems\1.9.1\gems\compass-*\lib\compass\compiler.rb#4. Make sure Assetic is configured properly:
Example (
config.yml):I use
%compass.bin%in my parameters file so that I can ease the transition of the codebase between Windows and *nix systems, so myparameters.ymllooks like this:#5. (Optional) Upgrade Assetic and AsseticBundle:
I have Assetic and AsseticBundle tagged to the very last possible commit that works with Symfony 2.0.x in my
depsfile:Make sure to replace
%ruby%in all of the paths above with your actual path toruby.exe, mine beingC:\Ruby\1.9.2.Steps #2 and #4 may or may not be required, but over the course of my time fighting with this issue, it is where I’ve ended up and my setup works (which is all I care about!).
Good luck!
Side question: Is your path to the SCSS/Compass binaries really in
%kernel.root_dir%/Resources/libs?