Skip to content

mikha-dev/nova-packages-tool

 
 

Repository files navigation

Tool for Laravel Nova Packages Development

Latest Stable Version Total Downloads Latest Unstable Version License

This library provides a versioning laravel-nova mixins dependency for 3rd party packages built for Laravel Nova.

Installation

To install through composer, run the following command from terminal:

composer require "nova-kit/nova-packages-tool:^1.0"

Next, make sure your application's composer.json contains the following command under script.post-autoload-dump:

{
  "script" : {
    "post-autoload-dump": [
      "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
    ]
  }
}

Usages

First, you need to add webpack.external alias to laravel-nova and comment the existing reference to vendor/laravel/nova/resources/js/mixins/js/packages.js under nova.mix.js:

webpackConfig.externals = {
  vue: 'Vue',
  'laravel-nova': 'LaravelNova'
}

// webpackConfig.resolve.alias = {
//   ...(webpackConfig.resolve.alias || {}),
//   'laravel-nova': path.join(
//   __dirname,
//   'vendor/laravel/nova/resources/js/mixins/packages.js'
//   ),
// }

This would allow your package to depends on laravel-nova from external source and no longer compiled it locally.

Theme Switched Event

Instead of manually registering custom MutationObserver on each package, you can now listen to a single nova-theme-switched event:

Nova.$on('nova-theme-switched', ({ theme, element }) => {
  if (theme === 'dark') {
    element.add('package-dark')
  } else {
    element.remove('package-dark')
  }
})

About

Tool for Laravel Nova Packages Development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • JavaScript 68.9%
  • PHP 31.1%