How can I get Assetic to compile SCSS on Zend Framework on Windows?

前端 未结 1 952
醉话见心
醉话见心 2021-01-16 18:24

My site is on Zend Framework and uses Assetic to compile SCSS and minify it.

It works wonderfully when I\'m developing on Ubuntu.

Sometimes I need to develop

相关标签:
1条回答
  • 2021-01-16 19:16

    I think I got it working, but I'm not 100% sure I could reproduce the steps to fix it.

    So please add a new answer if you figure out better details.

    I have Ruby installed at C:\Ruby193\. I needed to edit the sass.bat file in its 'bin' folder to be:

    @ECHO OFF
    IF NOT "%~f0" == "~f0" GOTO :WinNT
    @"ruby.exe" "C:/Ruby193/bin/sass" %1 %2 %3 %4 %5 %6 %7 %8 %9
    GOTO :EOF
    :WinNT
    @"C:/Ruby193/bin/ruby.exe" "%~dpn0" %*
    

    I read https://github.com/symfony/AsseticBundle/issues/81.

    I replaced the file at C:\wamp\bin\php\php5.3.10\PEAR\pear\Symfony\Component\Process\Process.php with https://raw.github.com/symfony/Process/master/Process.php.

    I don't know whether this matters, but Assetic was using forward slashes instead of the PHP constant called DIRECTORY_SEPARATOR, so:

    In Assetic\Filter\Sass\SassFilter.php, I added $root = str_replace('/', DIRECTORY_SEPARATOR, $root);//fix for Windows after $root = $asset->getSourceRoot();

    And slightly below that, I changed a line to $pb->add('--load-path')->add(dirname($root.DIRECTORY_SEPARATOR.$path));.

    0 讨论(0)
提交回复
热议问题