-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "Recommended" approach (#1886)
* Add a "Recommended" approach * Add blurb to Recommended
- Loading branch information
Showing
6 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Commands | ||
weight: 5 | ||
weight: 6 | ||
--- | ||
|
||
## Generating Datatable Components | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Configuration | ||
weight: 4 | ||
weight: 5 | ||
--- | ||
|
||
## Publishing Assets | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Including Assets | ||
weight: 3 | ||
weight: 4 | ||
--- | ||
|
||
## Package Specific Code | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Installation | ||
weight: 2 | ||
weight: 3 | ||
--- | ||
|
||
You can install the package via composer: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: Recommended | ||
weight: 2 | ||
--- | ||
|
||
While the package is very customisable, and supports a number of different approaches. The below is the recommended approach, that gives the best performance for the tables: | ||
|
||
## Installation | ||
``` | ||
composer require rappasoft/laravel-livewire-tables | ||
``` | ||
|
||
## Publish the Tables Config | ||
``` | ||
php artisan vendor:publish --tag="livewire-tables-config" | ||
``` | ||
|
||
## Livewire Tables Config Updates | ||
Update the published Livewire Tables Config (config/livewire-tables.php) and set the following to false: | ||
```php | ||
/** | ||
* Cache Rappasoft Frontend Assets | ||
*/ | ||
'cache_assets' => false, | ||
|
||
/** | ||
* Enable or Disable automatic injection of core assets | ||
*/ | ||
'inject_core_assets_enabled' => false, | ||
|
||
/** | ||
* Enable or Disable automatic injection of third-party assets | ||
*/ | ||
'inject_third_party_assets_enabled' => false, | ||
|
||
/** | ||
* Enable Blade Directives (Not required if automatically injecting or using bundler approaches) | ||
*/ | ||
'enable_blade_directives' => false, | ||
``` | ||
|
||
## Bundling the Assets | ||
As you have now told the package not to inject the assets, add the following to your resources/js/app.js file: | ||
|
||
```js | ||
import '../../vendor/rappasoft/laravel-livewire-tables/resources/imports/laravel-livewire-tables-all.js'; | ||
``` | ||
|
||
## Update Layouts | ||
Ensure that your layouts do not reference any of the following blade directives, as these are not required with the above approach | ||
``` | ||
<!-- Adds the Core Table Styles --> | ||
@rappasoftTableStyles | ||
<!-- Adds any relevant Third-Party Styles (Used for DateRangeFilter (Flatpickr) and NumberRangeFilter) --> | ||
@rappasoftTableThirdPartyStyles | ||
<!-- Adds the Core Table Scripts --> | ||
@rappasoftTableScripts | ||
<!-- Adds any relevant Third-Party Scripts (e.g. Flatpickr) --> | ||
@rappasoftTableThirdPartyScripts | ||
``` | ||
|
||
## Tailwind Specific | ||
If using Tailwind, you should update your tailwind.config.js file, adding the following to the "content" section under module.exports. This ensures that the Livewire Tables specific core classes are included. | ||
|
||
```js | ||
'./vendor/rappasoft/laravel-livewire-tables/resources/views/*.blade.php', | ||
'./vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php', | ||
``` | ||
|
||
It is also recommended to add the paths to any Livewire Tables components, for example: | ||
```js | ||
'./app/Livewire/*.php', | ||
'./app/Livewire/**/*.php', | ||
``` | ||
So that any classes used in setTdAttributes or similar are included! | ||
|
||
## Run your build process | ||
``` | ||
npm run build | ||
``` | ||
|
||
## Clear Cached Views | ||
``` | ||
php artisan view:clear | ||
``` | ||
|
||
You may of course run view:cache at this point. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Rendering | ||
weight: 6 | ||
weight: 7 | ||
--- | ||
|
||
## Rendering Components | ||
|