This package provides a console command to convert dynamic JS/CSS to static JS/CSS assets.

Overview

Hero

Laravel Nova Search

Latest Version Software License StyleCI Total Downloads

This package provides a console command to convert dynamic JS/CSS to static JS/CSS assets.

Requirements

  • laravel-mix v6.0+
  • php 7.3+
  • laravel nova 3.0+

Installation

You can install the package via composer:

composer require akki-io/laravel-nova-assets

Publish the package files:

php artisan vendor:publish --provider 'AkkiIo\LaravelNovaAssets\LaravelNovaAssetsServiceProvider'

This will publish the

  • config file config/laravel-nova-assets.php and
  • the webpack file webpack.mix.nova.js.

Usage

To create static assets the package provides a simple console command that will do the job for you.

Run

php artisan nova:mix

Once the command is executed you will need to update the laravel nova auth layout auth->layout.blade.php and main layout layout.blade.php to use the compiled assets.

  • Copy the auth layout vendor/laravel/nova/resources/views/auth/layout.blade.php to resources/views/vendor/nova/auth/layout.blade.php
  • Copy the main layout vendor/laravel/nova/resources/views/layout.blade.php to resources/views/vendor/nova/layout.blade.php

Add manifest files above the </head> tag for both files.

<link rel="manifest" href="/vendor/laravel-nova-assets/mix-manifest.json">

Replace these following section in the newly copied files.

Original Content

// Tool Styles
@foreach(\Laravel\Nova\Nova::availableStyles(....
    ....
@endforeach

New Content

<link rel="stylesheet" href="{{ mix('tool-styles.css', 'vendor/laravel-nova-assets') }}">

Original Content

<!-- Theme Styles -->
@foreach(\Laravel\Nova\Nova::themeStyles() ...)
    ....
@endforeach

New Content

<link rel="stylesheet" href="{{ mix('theme-styles.css', 'vendor/laravel-nova-assets') }}">

Original Content

<!-- Tool Scripts -->
@foreach (\Laravel\Nova\Nova::availableScripts(request()) ...)
.....
@endforeach

New Content

<script src="{{ mix('tool-scripts.js', 'vendor/laravel-nova-assets') }}"></script>

If you are using custom scripts and styles, add the following sections to these files accordingly.

<link rel="stylesheet" href="{{ mix('custom-styles.css', 'vendor/laravel-nova-assets') }}">
<script src="{{ mix('custom-scripts.js', 'vendor/laravel-nova-assets') }}"></script>

For copyright reason I cannot include those files in this project.

Adding custom CSS and JSS

You can specify you custom CSS/JS in the config file laravel-nova-assets.php under the styles and scripts section.

Running the command on a CI/CD

You will need to create a dummy user if you are using this command to generate assets. Unfortunately, I was not able to find a work around for this.

Using CDN

publiux/laravelcdn package provides a simple way to move these assets to CDN for better performance. Refer to the repo here for more information - https://github.com/publiux/laravelcdn

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

You might also like...
Laravel package to convert English numbers to Bangla number or Bangla text, Bangla month name and Bangla Money Format

Number to Bangla Number, Word or Month Name in Laravel | Get Wordpress Plugin Laravel package to convert English numbers to Bangla number or Bangla te

Laravel package to convert currencies to/from Ghana Cedis(GHS).

Kudi About A Laravel package to convert currencies to/from Ghana Cedis(GHS). Installation composer require iamkarsoft\kudi Publishing config files php

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A laravel Livewire Dynamic Selects with multiple selects depending on each other values, with infinite levels and totally configurable.
A laravel Livewire Dynamic Selects with multiple selects depending on each other values, with infinite levels and totally configurable.

Livewire Combobox: A dynamic selects for Laravel Livewire A Laravel Livewire multiple selects depending on each other values, with infinite levels of

Dynamic Laravel Livewire Bootstrap 5 modals.

Laravel Livewire Modals Dynamic Laravel Livewire Bootstrap 5 modals. Requirements Bootstrap 5 Installation Require the package: composer require basti

Dynamic Laravel Livewire Bootstrap toasts.

Laravel Livewire Toasts This package allows you to dynamically show Bootstrap toasts via Laravel Livewire components. Documentation Requirements Insta

A dynamic table component for Laravel Livewire - For Slack access, visit:
A dynamic table component for Laravel Livewire - For Slack access, visit:

A dynamic Laravel Livewire component for data tables. Bootstrap 4 Demo | Bootstrap 5 Demo | Tailwind Demo | Demo Repository Installation You can insta

A dynamic Laravel Livewire component for multi steps form
A dynamic Laravel Livewire component for multi steps form

Livewire component that provides you with a wizard that supports multiple steps form while maintaining state.

Laravel package that converts your application into a static HTML website
Laravel package that converts your application into a static HTML website

phpReel Static Laravel Package phpReel Static is a simple Laravel Package created and used by phpReel that converts your Laravel application to a stat

Releases(v1.1)
Owner
Akki Khare
I have a passion for web standards and solving interesting problems. I create fun JS Apps, do Car Mods. I have a dog named Max. #shredlife #labradorabrable
Akki Khare
Laminas\Console is a component to design and implement console applications in PHP.

laminas-console This package is abandoned and will receive no further development! We recommend using laminas/laminas-cli. Laminas\Console is a compon

Laminas Project 10 Nov 27, 2021
🔌 Convert Bootstrap CSS code to Tailwind CSS code

Tailwindo This tool can convert Your CSS framework (currently Bootstrap) classes in HTML/PHP (any of your choice) files to equivalent Tailwind CSS cla

Awssat 938 Dec 24, 2022
Jumpstart your web development journey with the HALT Stack Starter Kit, a one-command solution for creating dynamic, scalable, and clean web applications.

Welcome to the HALT Stack Starter Kit! This kit is designed to help you kickstart your web development projects using the HALT Stack, a powerful combi

HALT Stack 6 Jun 7, 2023
Flow package to synchronize metadata and binary data of imported Neos.Media assets

Wwwision.AssetSync Flow package to synchronize metadata and resources of imported Neos.Media assets Installation Install this package via: composer re

Bastian Waidelich 5 Feb 7, 2022
This package provides you with a simplistic `php artisan make:user` command

Laracademy Generators Laracademy make:user Command - provides you with a simplistic artisan command to generate users from the console. Author(s): Lar

Laracademy 18 Jan 19, 2019
Laravel-Mix helper for projects with complex & multi assets.

Laravel-Mix helper for projects with complex & multi assets. ?? Getting started Since mix introduced in laravel 5.4 it is recommended to use this pack

Fandogh 27 Oct 4, 2022
Add internal link to your published assets.

WORK IN PROGRESS, some functionalities may be changed in the future. Add internal link to your published assets. Installation You can install the pack

Kaqaz Studio 1 Aug 9, 2022
A simple laravel package to validate console commands arguments and options.

Command Validator A simple laravel package to validate console commands arguments and options. Installation Require/Install the package using composer

Touhidur Rahman 20 Jan 20, 2022
A wrapper package to run mysqldump from laravel console commands.

A wrapper package to run mysqldump from laravel console commands.

Yada Khov 24 Jun 24, 2022
Laravel package to convert English numbers to Bangla number or Bangla text, Bangla month name and Bangla Money Format

Number to Bangla Number, Word or Month Name in Laravel | Get Wordpress Plugin Laravel package to convert English numbers to Bangla number or Bangla te

Md. Rakibul Islam 50 Dec 26, 2022