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

Assets Laravel Package

nette/assets

Nette Assets is a lightweight asset pipeline for Nette apps. It helps you manage and reference CSS/JS, handle versioning/cache busting, and organize assets for development and production builds with a simple API and configuration.

View on GitHub
Deep Wiki
Context7

Elegant asset management for PHP with versioning, caching and providers for various storage backends

Frequently asked questions about Assets
Can I use Nette Assets in Laravel without replacing Laravel Mix/Vite for bundling?
Yes. Nette Assets focuses on static assets (CSS, JS, fonts) and versioning, while Laravel Mix/Vite handles bundling. For Vite, use the `ViteMapper` to proxy dev server requests, and register your build outputs (e.g., `public/build/`) as asset directories in Nette’s config. This keeps bundling separate from asset management.
How do I integrate Nette Assets with Laravel’s Blade templating?
Nette Assets doesn’t support Laravel’s `@asset()` or `@vite()` directives natively. You’ll need to create a custom Blade directive (e.g., `@asset('main.css')`) or a facade wrapper (e.g., `Asset::url('main.css')`) to bridge the gap. The package provides a simple API for generating URLs, but Blade integration requires minor setup.
Does Nette Assets support Laravel’s caching system (e.g., config caching)?
Nette Assets manages its own caching for asset versioning, but it can coexist with Laravel’s caching. Disable versioning in development via `AppServiceProvider` to avoid conflicts. For edge cases, use file-based hashing instead of global versioning to align with Laravel’s cache tags or `php artisan cache:clear`.
Will Nette Assets work with Laravel’s Flysystem or S3 storage?
Nette Assets supports storage backends via the `IStorage` interface, but Laravel’s Flysystem or S3 adapters aren’t included out of the box. You’ll need to extend `IStorage` or use a custom adapter to integrate with Laravel’s storage system. The package’s architecture makes this feasible with minimal effort.
Can I use Nette Assets for dynamic assets like user uploads?
Nette Assets is designed for static assets (CSS, JS, fonts) and isn’t optimized for dynamic content like user uploads. For dynamic assets, you’d need to implement a custom `IStorage` adapter or handle them separately. The package’s focus is on performance and versioning for pre-defined assets.
How does Nette Assets handle asset versioning in production?
Nette Assets automatically appends version queries (e.g., `?v=1.23`) to asset paths to bust caches in production. You can configure global versioning or file-based hashing (e.g., `?v=md5-hash`). This resolves Laravel’s stale asset issues without manual intervention, improving Core Web Vitals like LCP.
Does Nette Assets support WOFF2 fonts and crossorigin attributes?
Yes. Nette Assets includes built-in support for WOFF2 fonts and automatically adds `crossorigin` attributes for external fonts, which is critical for performance and security. This simplifies CSP compliance and reduces layout shift issues in Chrome DevTools’ Font Audit.
What Laravel versions does Nette Assets support?
Nette Assets is framework-agnostic but works with Laravel 8+ due to its PHP 8.0+ requirements. While it isn’t officially Laravel-specific, its features (versioning, caching, storage abstraction) align well with Laravel’s needs. Test thoroughly with your Laravel version, as some Blade or service container integrations may need adjustments.
How do I disable versioning for development in Laravel?
Disable versioning in your `AppServiceProvider` by configuring the `AssetManager` to skip version queries in development. For example, set `AssetManager::setTemporary(true)` or adjust the `debugMode` in the package’s config. This avoids unnecessary queries during development while keeping production optimized.
Are there alternatives to Nette Assets for Laravel asset management?
For Laravel, alternatives include Laravel Mix (for bundling) or Vite (modern frontend tooling), which handle asset hashing and versioning natively. If you need a lightweight, non-bundling solution, consider packages like `laravel-mix` (for Mix integration) or `spatie/laravel-ignition` (for error pages). Nette Assets stands out for its storage abstraction and font optimization but requires custom Laravel integration.
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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony