covaleski / sass-php
Install and run Sass using Composer.
v0.1.3
2026-07-19 17:39 UTC
Requires
- symfony/console: ^8.1
- symfony/filesystem: ^8.1
- symfony/http-client: ^8.1
- symfony/process: ^8.1
Requires (Dev)
- phpunit/phpunit: ^13.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Run Sass binaries from Composer and compile SCSS files programatically from PHP.
Installation
Install this package using the Composer package manager:
composer require covaleski/sass-php
Usage
Use the vendor/bin/sass-php to install, update or remove Sass:
vendor/bin/sass-php install vendor/bin/sass-php install latest vendor/bin/sass-php install 1.101.0 vendor/bin/sass-php use 1.101.0 vendor/bin/sass-php remove 1.101.0 vendor/bin/sass-php remove all vendor/bin/sass-php autoremove
Once a Sass binary is downloaded, use vendor/bin/sass to compile SCSS files:
vendor/bin/sass input.scss output.css
To programatically interact with Sass from PHP, use the Sass facade:
use Covaleski\SassPhp\Sass\Sass; Sass::build() ->setStyle(Sass::COMPRESSED) ->generateSourceMap(false) ->setInputFile('input.scss') ->setOutputFile('output.css') ->getProcess() ->run();
The build() method provides a SassProcessBuilder instance, which creates a
Symfony Process instance with all applicable Sass options once you call the
getProcess() method.
The Sass binaries you installed using the
sass-phpcommand are automatically detected by the process builder.