Skip to content

Commit

Permalink
V3 Custom Script Path - V2 (#1557)
Browse files Browse the repository at this point in the history
* Add Capability to set Custom Script Path for Scripts/Styles

* Fix styling

* Update CHANGELOG

---------

Co-authored-by: lrljoe <lrljoe@users.noreply.github.com>
  • Loading branch information
lrljoe and lrljoe authored Nov 18, 2023
1 parent 0ab854c commit 155c654
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `laravel-livewire-tables` will be documented in this file

## UNRELEASED
- Add capability to set a custom script path for the scripts/styles by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1557
- Added missing tailwind background colour class for when hovering over the clear button in dark mode by @slakbal in https://github.com/rappasoft/laravel-livewire-tables/pull/1553


## [v3.1.3] - 2023-11-03
- Add additional Lifecycle Hook by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1534
- SettingColumns/ColumnsSet
Expand Down
5 changes: 5 additions & 0 deletions config/livewire-tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
*/
'enable_blade_directives ' => false,

/**
* Customise Script & Styles Paths
*/
'script_base_path' => '/rappasoft/laravel-livewire-tables',

/**
* Filter Default Configuration Options
*
Expand Down
15 changes: 14 additions & 1 deletion docs/start/including-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ This is enabled by default, but to re-enable, enable the following options in th
* Enable or Disable automatic injection of third-party assets
*/
'inject_third_party_assets_enabled' => true,

```

#### Changing Script Path

You can change the path used by customising the script_base_path option in the configuration file:

```php
/**
* Customise Script & Styles Paths
*/
'script_base_path' => '/rappasoft/laravel-livewire-tables',
```

### Bundler Including
Expand Down Expand Up @@ -61,4 +73,5 @@ Update the following options in the livewire-tables configuration file, to disab
*/
'enable_blade_directives ' => false,

```
```

8 changes: 4 additions & 4 deletions src/Mechanisms/RappasoftFrontendAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ public function boot(): void
{
// Set the JS route for the core tables JS
app($this::class)->setRappasoftTableScriptRoute(function ($handle) {
$scriptPath = '/rappasoft/laravel-livewire-tables/core.min.js';
$scriptPath = rtrim(config('livewire-tables.script_base_path', '/rappasoft/laravel-livewire-tables'), '/').'/core.min.js';

return Route::get($scriptPath, $handle);
});

// Set the CSS route for the core tables CSS
app($this::class)->setRappasoftTableStylesRoute(function ($handle) {
$stylesPath = '/rappasoft/laravel-livewire-tables/core.min.css';
$stylesPath = rtrim(config('livewire-tables.script_base_path', '/rappasoft/laravel-livewire-tables'), '/').'/core.min.css';

return Route::get($stylesPath, $handle);
});

// Set the JS route for the third party JS
app($this::class)->setRappasoftTableThirdPartyScriptRoute(function ($handle) {
$scriptPath = '/rappasoft/laravel-livewire-tables/thirdparty.min.js';
$scriptPath = rtrim(config('livewire-tables.script_base_path', '/rappasoft/laravel-livewire-tables'), '/').'/thirdparty.min.js';

return Route::get($scriptPath, $handle);
});

// Set the CSS route for the third party CSS
app($this::class)->setRappasoftTableThirdPartyStylesRoute(function ($handle) {
$stylesPath = '/rappasoft/laravel-livewire-tables/thirdparty.css';
$stylesPath = rtrim(config('livewire-tables.script_base_path', '/rappasoft/laravel-livewire-tables'), '/').'/thirdparty.css';

return Route::get($stylesPath, $handle);
});
Expand Down

0 comments on commit 155c654

Please sign in to comment.