Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,22 @@ Requires PHP `^8.4.1 || ^8.5` and Laravel `^13.0`.
composer require laranail/assets
```

## Quick start
## Quick start guide and usage

### Getting started

1. Publish the config and declare each asset under `resources.scripts` or `resources.styles`;
the top-level `scripts` and `styles` lists name the ones loaded on every page.

```bash
php artisan vendor:publish --tag=laranail::assets-config
```

2. `ASSETS_OFFLINE` defaults to `true`, which serves every asset from its `local` source. Set it to
`false` to use the `cdn` source of assets marked `use_cdn`. `ASSETS_ENABLE_VERSION=true` appends
`?v=` plus `ASSETS_VERSION` to each URL.

### Usage

```blade
{{-- resources/views/layouts/app.blade.php --}}
Expand All @@ -35,6 +50,11 @@ composer require laranail/assets
@php(Assets::addScriptsDirectly('js/checkout.js'))
```

```php
// Queue assets declared under resources.* by name, from a controller or a view
Assets::addScripts(['modernizr'])->addStyles(['bootstrap']);
```

The registered names and design are in [Architecture](docs/architecture.md); everything else is in the [documentation index](#documentation).

## <a name="documentation"></a>Documentation
Expand Down
Loading