Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Scssphp Bundle

Scssphp Bundle Laravel Package

armin/scssphp-bundle

View on GitHub
Deep Wiki
Context7

Symfony bundle to parse scss sources at runtime.

Frequently asked questions about Scssphp Bundle
Can I use this bundle in Laravel instead of Symfony? If so, how?
This bundle is designed for Symfony, but you could adapt it for Laravel by manually integrating the underlying `scssphp/scssphp` package. Laravel’s Blade templates would need custom logic to handle SCSS compilation, and you’d bypass Symfony’s Asset component. The bundle’s Twig integration won’t work natively, so expect refactoring for Laravel’s asset pipeline (e.g., Laravel Mix or Vite).
How do I disable auto-update in production to avoid race conditions?
Set `auto_update: false` in your `scssphp.yaml` configuration. In production, use the CLI command `php bin/console scssphp:compile` during deployment or integrate it into your CI/CD pipeline. Avoid runtime compilation in high-traffic environments to prevent memory spikes and stale asset issues.
What’s the performance difference between this and Node.js (Dart Sass) for large projects?
PHP-based SCSS compilation is significantly slower than Node.js. Benchmark your assets: if you process >100K requests/hour, offload compilation to a build step (e.g., CI/CD or Docker). For dev environments, the tradeoff is worth it for real-time feedback, but production should use pre-compiled assets with caching (e.g., Symfony’s AssetMapper with versioning).
Does this bundle support advanced Sass features like `@use` or custom functions?
No, the underlying `scssphp/scssphp` package lacks support for modern Sass features like `@use` or custom functions. If your project relies on these, consider sticking with Node.js (Dart Sass) or evaluating alternatives like `league/sass-compass` for partial compatibility. Migrate simple variables/functions first to assess effort.
How do I configure Bootstrap or other frameworks with this bundle?
Add Bootstrap’s SCSS files to your `import_paths` in `scssphp.yaml` (e.g., `import_paths: ['%kernel.project_dir%/vendor/bootstrap/scss']`). Ensure paths are absolute and resolve correctly in multi-project setups. For frameworks like Bootstrap, also configure variables in the bundle’s `variables` section to override defaults.
Will this work with Laravel’s Blade templates instead of Twig?
No, this bundle requires Twig for template integration. For Laravel, you’d need to manually compile SCSS files using `scssphp/scssphp` and embed the output in Blade templates via `{{ asset() }}`-like logic. Consider Laravel-specific tools like Laravel Mix or Vite for a seamless workflow, as they handle SCSS natively with Webpack.
How do I cache compiled CSS to reduce runtime overhead?
Disable `auto_update` in production and use Symfony’s AssetMapper with `stamp` or `version` strategies to invalidate caches on SCSS changes. For Laravel, implement a similar cache-busting mechanism (e.g., `asset()` with `?v=1.2.3`). Pre-compile assets in CI/CD and serve them statically to minimize runtime compilation.
Are there alternatives for Laravel that don’t require Node.js?
For Laravel, alternatives include `league/sass-compass` (PHP-based, but limited to Compass syntax) or `filp/whoops` for error handling during manual SCSS compilation. However, none match the Symfony integration depth of `armin/scssphp-bundle`. If you’re tied to Laravel, evaluate the effort to port this bundle or use a hybrid approach (e.g., compile SCSS in CI/CD and embed the output).
How do I debug SCSS errors in production where the Profiler isn’t available?
Enable the Profiler in staging and check the SCSSPHP toolbar for errors. In production, log compilation errors to a file or monitoring tool (e.g., Sentry) by configuring `error_handler` in `scssphp.yaml`. For critical failures, implement a fallback to serve cached CSS while alerting your team. Use the CLI command `php bin/console scssphp:compile` with `-v` for verbose error output.
What Laravel versions or packages can integrate with this bundle if I’m using Symfony?
If you’re using Symfony alongside Laravel (e.g., in a microservice architecture), this bundle won’t directly integrate with Laravel’s Blade or asset pipeline. For shared SCSS assets, compile them in Symfony and serve the CSS files statically to Laravel via a CDN or shared storage. Avoid mixing Twig and Blade for the same assets to prevent conflicts.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware