- How do I install twig/cssinliner-extra in a Laravel project using Twig?
- Run `composer require twig/cssinliner-extra` and ensure your Laravel Twig bridge is configured. The package extends Twig’s native capabilities, so no additional Laravel-specific setup is required beyond enabling Twig in your project.
- Can I use this package with Laravel Blade templates?
- No, this package is Twig-only. If your project relies on Blade for emails, you’ll need to either switch to Twig for email templates or explore alternatives like manual CSS inlining or dedicated email templating tools.
- What Laravel versions does twig/cssinliner-extra support?
- The package works with any Laravel version that supports Twig via the `laravelcollective/html` or `tightenco/ziggy` bridges. However, ensure your Twig version aligns with the package’s requirements, as it’s not actively maintained.
- Does the inline_css filter handle media queries or complex CSS selectors?
- No, the package silently drops unsupported selectors like `@media`, `:hover`, or combinators. For advanced email designs, you’ll need to simplify CSS or manually inline styles where complex rules are required.
- Is there a way to pre-process CSS inlining for better performance?
- Yes, the package supports build-time processing via Artisan commands (e.g., `php artisan email:inline-css`). This reduces runtime overhead, making it ideal for high-volume email campaigns when combined with Laravel queues or caching.
- What are the security risks of using remote: true for external CSS?
- Enabling `remote: true` introduces XSS vulnerabilities if external CSS sources aren’t trusted. Disable this option unless you’ve implemented strict input validation or use a controlled CDN for static assets.
- How does this package compare to Laravel’s built-in CSS inlining tools?
- Unlike Laravel’s Blade, this package is Twig-specific and offers deeper integration with Twig’s filter system. It’s better suited for projects already using Twig, while Blade lacks native CSS inlining support for emails.
- Will this package break if I update Twig or Laravel?
- Potentially, as the package is abandoned and lacks recent updates. Test thoroughly after major version changes, and consider forking or replacing it if compatibility issues arise.
- Can I use this for dynamic email templates in Laravel Notifications?
- Yes, but you’ll need to ensure your notification templates use Twig. Process the HTML output with the `inline_css` filter before sending, either manually or via a custom Artisan command.
- Are there alternatives for Laravel email CSS inlining?
- For Blade users, consider manual inlining or tools like `php-html-mail` or `league/html-to-markdown`. Twig users might explore `twig/extra` or fork this package for maintenance. Always weigh trade-offs like compatibility and performance.