norman-huth/nova-assets-changer

Change Nova resources

v1.2.1 2023-10-28 17:25 UTC

This package is auto-updated.

Last update: 2024-06-30 00:52:54 UTC


README

Nova Assets Changer

This package is for Nova 4 and swaps the resources from the resources/Nova/Nova folder with those in the vendor/laravel/nova/resources/js folder or use the php artisan custom-assets:publish command.
Then the assets are recompiled and published with the Force option.

This package creates a backup of each file and checks for changes

Attention. The original vendor files will be overwritten.

IMPORTANT

You must run the php artisan nova:custom-assets after every composer update!

Tip: You can replace @php artisan nova:publish with @php artisan custom-assets:after-composer-update in Your composer.json

Install

composer require norman-huth/nova-assets-changer --dev

Running

For the full process run this command:

php artisan nova:custom-assets

Optional

Run Command Only If A Nova Update Is Detected (Or The Package Has No Version Saved)

php artisan custom-assets:after-composer-update

Publish Nova Assets Via Command

php artisan custom-assets:publish

Publish Nova Field Assets Via Command (experimental)

php artisan custom-assets:publish:field

Notice

After a Nova update, you need to check your resource files to see if they are still compatible.

Examples

I make not a release for every example. For all example resources take a look in the resources folder of the GitHub repository.

⚠️ These files are all based on one of the first Nova 4 releases and serve only as an example! ⚠️

Other Composer Or NPM Command

Create a command: php artisan make:command CustomAssetsCommand

with followingen content:

<?php

namespace App\Console\Commands;

use NormanHuth\NovaAssetsChanger\Console\Commands\CustomAssetsCommand as Command;

class CustomAssetsCommand extends Command
{
    /**
     * CLI Composer Command
     *
     * @var string
     */
    protected string $composerCommand = 'composer';

    /**
     * CLI NPM Command
     *
     * @var string
     */
    protected string $npmCommand = 'npm';
}

Add Custom CSS

Create resources/Nova/custom.css with Your custom CSS.

Register new pages

Example: Register Page

More Laravel Nova Packages

Stand With Ukraine