Skip to content

Conversation

@Be-Mann
Copy link

@Be-Mann Be-Mann commented Jan 22, 2026

Summary

This PR adds compatibility with scssphp 2.x while maintaining backward compatibility with scssphp 1.x.

Problem

The current implementation uses Compiler::getParsedFiles() which was removed in scssphp 2.0. This causes a fatal error when using mrclay/minify with scssphp 2.x:

Fatal error: Call to undefined method ScssPhp\ScssPhp\Compiler::getParsedFiles()
in vendor/mrclay/minify/lib/Minify/ScssCssSource.php

Since scssphp 2.x is required for PHP 8.5 compatibility, this fix is necessary for future PHP versions.

Changes

  • Updated Minify_ScssCssSource::compile() to use CompilationResult::getIncludedFiles() for scssphp 2.x
  • Falls back to Compiler::getParsedFiles() for scssphp 1.x (runtime detection via method_exists())
  • The new scssphp 2.x API returns file paths only, so modification times are now retrieved via filemtime()
  • Updated composer.json to allow scssphp/scssphp: ^1.12|^2.0

Related Issues

Fixes #715

- Use CompilationResult::getIncludedFiles() for scssphp 2.x
- Fall back to Compiler::getParsedFiles() for scssphp 1.x
- Runtime detection via method_exists()

Fixes compatibility with PHP 8.5+ which requires scssphp 2.x
Related: mrclay#715
- Update .semver to 4.0.2
- Add changelog entry for scssphp 2.x compatibility
- Update composer.json to allow scssphp ^1.12|^2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support scssphp 2.0 – Remove usage of removed getParsedFiles() method

1 participant