Skip to content

Commit 6857f0a

Browse files
committed
Add nova-tools manifest file for asset versioning
1 parent ea8cc3e commit 6857f0a

File tree

7 files changed

+121
-65
lines changed

7 files changed

+121
-65
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"require": {
2424
"php": "^8.2",
2525
"fidum/laravel-nova-metrics-polling": "^1.0",
26+
"fidum/nova-package-bundler-command": "^1.8",
2627
"intervention/image-laravel": "*",
2728
"laravel/framework": "^12.0",
2829
"laravel/nova": "^5.0",
@@ -77,7 +78,8 @@
7778
],
7879
"post-update-cmd": [
7980
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
80-
"@php artisan nova:publish --ansi"
81+
"@php artisan nova:publish --ansi",
82+
"@php artisan nova:tools:publish"
8183
],
8284
"dev": [
8385
"Composer\\Config::disableProcessTimeout",
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Output paths
7+
|--------------------------------------------------------------------------
8+
|
9+
| Define the output paths where the command will save the contents of the
10+
| bundled packages. These paths will be wrapped with `public_path` as
11+
| the output needs to always end up in the public directory so that
12+
| we can tell Nova to load it via the ASSET_URL.
13+
|
14+
*/
15+
'paths' => [
16+
'script' => '/vendor/nova-tools/app.js',
17+
'style' => '/vendor/nova-tools/app.css',
18+
],
19+
20+
/*
21+
|--------------------------------------------------------------------------
22+
| Download url assets
23+
|--------------------------------------------------------------------------
24+
|
25+
| Set this value to `true` if you want the bundler command to download
26+
| assets where the path is already a url. When `false`, url assets are
27+
| ignored when bundling and nova will load them as normal.
28+
|
29+
*/
30+
'download_url_assets' => false,
31+
32+
/*
33+
|--------------------------------------------------------------------------
34+
| Excluded assets
35+
|--------------------------------------------------------------------------
36+
|
37+
| Define the assets to skip when bundling packages. The name of the script
38+
| or style with which it is added is expected here.
39+
|
40+
*/
41+
'excluded' => [
42+
'scripts' => [],
43+
'styles' => [],
44+
],
45+
46+
/*
47+
|--------------------------------------------------------------------------
48+
| Versioning
49+
|--------------------------------------------------------------------------
50+
|
51+
| Enable versioning of generated assets. This will append a query string
52+
| to the asset path with a unique value based on the file content. This
53+
| is done by generating a manifest file that maps the original path to
54+
| the versioned path.
55+
|
56+
| Note: This feature requires the `manifest.json` file to be readable in
57+
| the public directory.
58+
|
59+
*/
60+
'version' => [
61+
'enabled' => true,
62+
63+
'manifest' => '/vendor/nova-tools/manifest.json',
64+
],
65+
];

config/nova.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Laravel\Nova\Actions\ActionResource;
4+
use Fidum\NovaPackageBundler\Http\Middleware\OverrideNovaPackagesMiddleware;
45

56
return [
67

@@ -84,6 +85,7 @@
8485
'web',
8586
\Laravel\Nova\Http\Middleware\HandleInertiaRequests::class,
8687
'nova:serving',
88+
OverrideNovaPackagesMiddleware::class
8789
],
8890

8991
'api_middleware' => [

public/js/app.js

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -186,70 +186,6 @@ feather.replace();
186186
}
187187
})();
188188

189-
/*********************/
190-
/* Contact js */
191-
/*********************/
192-
try {
193-
// Contact Form
194-
function validateForm() {
195-
var name = document.forms["myForm"]["name"].value;
196-
var email = document.forms["myForm"]["email"].value;
197-
var subject = document.forms["myForm"]["subject"].value;
198-
var comments = document.forms["myForm"]["comments"].value;
199-
document.getElementById("error-msg").style.opacity = 0;
200-
document.getElementById('error-msg').innerHTML = "";
201-
if (name == "" || name == null) {
202-
document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Name*</div>";
203-
fadeIn();
204-
return false;
205-
}
206-
if (email == "" || email == null) {
207-
document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Email*</div>";
208-
fadeIn();
209-
return false;
210-
}
211-
if (subject == "" || subject == null) {
212-
document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Subject*</div>";
213-
fadeIn();
214-
return false;
215-
}
216-
if (comments == "" || comments == null) {
217-
document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Comments*</div>";
218-
fadeIn();
219-
return false;
220-
}
221-
var xhttp = new XMLHttpRequest();
222-
xhttp.onreadystatechange = function () {
223-
if (this.readyState == 4 && this.status == 200) {
224-
document.getElementById("simple-msg").innerHTML = this.responseText;
225-
document.forms["myForm"]["name"].value = "";
226-
document.forms["myForm"]["email"].value = "";
227-
document.forms["myForm"]["subject"].value = "";
228-
document.forms["myForm"]["comments"].value = "";
229-
}
230-
};
231-
xhttp.open("POST", "php/contact.php", true);
232-
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
233-
xhttp.send("name=" + name + "&email=" + email + "&subject=" + subject + "&comments=" + comments);
234-
return false;
235-
}
236-
237-
function fadeIn() {
238-
var fade = document.getElementById("error-msg");
239-
var opacity = 0;
240-
var intervalID = setInterval(function () {
241-
if (opacity < 1) {
242-
opacity = opacity + 0.5
243-
fade.style.opacity = opacity;
244-
} else {
245-
clearInterval(intervalID);
246-
}
247-
}, 200);
248-
}
249-
} catch (error) {
250-
251-
}
252-
253189
/*********************/
254190
/* WoW Js */
255191
/*********************/

0 commit comments

Comments
 (0)