Yii 2 and Scss

Hi All,

I just tried to register a scss file using my AppAsset.

I just installed Sass on my machine and verified it.

If i try and load my application I get the following:




AssetConverter command 'sass "<path to webroot>/css/site.scss" "<path to webroot>/css/site.css" --sourcemap' failed with exit code 1:

STDOUT:


STDERR:

'sass' is not recognized as an internal or external command,

operable program or batch file.



however if i copy the following from the error message and run it in a normal windows command prompt




sass "<path to webroot>/css/site.scss" "<path to webroot>/css/site.css" --sourcemap



it works fine … apart from giving me a warning that --sourcemap is deprecated. Sourcemaps are now generated by default, so this flag has no effect.

Has anyone had this issue ? Is it the warning that is causing this to fail ?

I haven’t tried changing the commands yet ? is it worth a try?

Thanks

Hi all,

I found the solution.

Although running




sass "<path to webroot>/css/site.scss" "<path to webroot>/css/site.css" --sourcemap

through windows CMD seemed to work fine. There was something weird happening with the path varible in windows when ran through proc_open

The solution was to provide the full path to the sass executible. I am using the Advance template so in backend/config/min-local.php I have added the following:




'components' => [

        'assetManager' => [

            'converter' => [

                'class' => 'yii\web\AssetConverter',

                'commands' => [

                    'scss' => ['css', 'C:\Ruby22\bin\sass {from} {to}']

                ],

            ],

        ],

    ],



I still need to wrap an environment wrapper around this as my production server is on linux.

But hopefully it should help anyone else that is stuck with this problem