-
Notifications
You must be signed in to change notification settings - Fork 682
Simplify asset story #1438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify asset story #1438
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/vendor | ||
/laravel | ||
/node_modules | ||
/public/app.js.LICENSE.txt | ||
/phpunit.xml | ||
composer.lock | ||
.phpunit.result.cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,34 @@ | ||
php: | ||
preset: laravel | ||
js: true | ||
css: true | ||
js: | ||
tab-width: 4 | ||
use-tabs: false | ||
print-width: 120 | ||
double-quotes: false | ||
trailing-commas: es5 | ||
semicolons: true | ||
arrow-parens: always | ||
bracket-same-line: false | ||
bracket-spacing: true | ||
finder: | ||
exclude: | ||
- "dist" | ||
- "node_modules" | ||
- "vendor" | ||
name: | ||
- "*.js" | ||
- "*.jsx" | ||
css: | ||
tab-width: 4 | ||
use-tabs: false | ||
print-width: 120 | ||
double-quotes: false | ||
finder: | ||
exclude: | ||
- "dist" | ||
- "node_modules" | ||
- "vendor" | ||
name: | ||
- "*.css" | ||
- "*.scss" | ||
- "*.less" | ||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
{ | ||
"name": "laravel-horizon", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "npm run development", | ||
"development": "NODE_ENV=development vite build --mode=development", | ||
"watch": "NODE_ENV=development vite build --mode=development --watch", | ||
"prod": "npm run production", | ||
"production": "NODE_ENV=production vite build" | ||
"build": "vite build", | ||
"watch": "vite build --watch" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue2": "^2.3.1", | ||
"axios": "^1.6.8", | ||
"bootstrap": "~5.1.3", | ||
"chart.js": "^2.9.4", | ||
"highlight.js": "^10.7.3", | ||
"laravel-vite-plugin": "^1.0.2", | ||
"md5": "^2.3.0", | ||
"moment": "^2.30.1", | ||
"moment-timezone": "^0.5.45", | ||
"phpunserialize": "^1.3.0", | ||
"resolve-url-loader": "^5.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a webpack plugin. We don't need it anymore as we use Vite. |
||
"sass": "^1.74.1", | ||
"sql-formatter": "^4.0.2", | ||
"vite": "^5.2.8", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import axios from 'axios'; | ||
import Vue from 'vue'; | ||
import Vue from 'vue/dist/vue.esm.js'; | ||
import VueRouter from 'vue-router'; | ||
import VueJsonPretty from 'vue-json-pretty'; | ||
import 'vue-json-pretty/lib/styles.css'; | ||
|
@@ -8,8 +8,6 @@ import Routes from './routes'; | |
import Alert from './components/Alert.vue'; | ||
import SchemeToggler from './components/SchemeToggler.vue'; | ||
|
||
import.meta.glob(['../img/**']); | ||
|
||
Comment on lines
-11
to
-12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was here for the Favicon. We don't need it anymore as we inline the favicon. |
||
let token = document.head.querySelector("meta[name='csrf-token']"); | ||
|
||
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
@php | ||
$nonExistentFileName = public_path('/vendor/horizon/nonExistentFile'); | ||
$previousHotFile = Vite::hotFile(); | ||
|
||
Vite::useHotFile($nonExistentFileName); | ||
@endphp | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Meta Information --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="csrf-token" content="{{ csrf_token() }}"> | ||
<link rel="shortcut icon" href="{{ Vite::asset('resources/img/favicon.png', 'vendor/horizon') }}"> | ||
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAipJREFUeNrEV8txwjAQtQ2HHCmB3JKbSQOYCoA0gD0pgFBBwpEToQAGKmDglpwgFdg5kZtNB1BBsuusZ4RY2ZZjYGd2jGWh97Q/rUwjpziPT3V4dECboDZoXZoSka5Al5vFNMqzrpkD2IFHn8B1ZAM6BCKbQgQAuAaPWQFgjoinsoipAEcTr0FrRjmyJxLLTAI5wXFXAehBGMPYcDKIIIm5kkAGOJpwAjqHRfYpbkOXvTBBypIwpT+HCvA3Cqi9Rta8EhHOHS1YCy1oWMKHmQIcGQ90wGMfLaZIoEGAoiDGOHmxhFTr5PGZJgncZYszEGC6ogX6nNn/Ay6RGDCfYveYVOFCJuAaumbPiIk1kyUNS2H6SZngyZrMWM+i/JVlXjK4QUVI3pRTpYPlaG6yeyGvm0Jef1ItiArwQBKu8G5bTMEIhKLkU3q65D+HgieE7+MCBHbygMVMOlCK+CnVDOUZ5s00ghCt2T45C+DDD2MBW/O066YFLYGvuXU5C9i6GYaLUzqr+olQtS5aIMwwtW6QfQnv7awNVanolEWgo9nABBb1cNeSmMDyigRWZkqdPrdEkDm3SRYMr7D7odwRXdIK8e7lOuAxh8W5pHtSiOhw8S4A7iX9IErlyC5b/7t+/7Ar4TKiEuyyRuJA5cQ5Wz8gEhgPNyXvfCQPVtgI+SPxAT/vSqiSEbXh70Uvp27GRSMNeJjV2Jp5V6MGpUeuUR0wAemKuwdy8ivAAJcc0R2NFxWtAAAAAElFTkSuQmCC"> | ||
|
||
<title>Horizon{{ config('app.name') ? ' - ' . config('app.name') : '' }}</title> | ||
|
||
<!-- Style sheets--> | ||
<link rel="preconnect" href="https://fonts.bunny.net"> | ||
<link href="https://fonts.bunny.net/css?family=figtree:300,400,500,600" rel="stylesheet" /> | ||
|
||
<link rel="preload" as="style" href="{{ Vite::asset('resources/sass/styles.scss', 'vendor/horizon') }}" /> | ||
<link rel="stylesheet" href="{{ Vite::asset('resources/sass/styles.scss', 'vendor/horizon') }}" data-scheme="light" /> | ||
<link rel="preload" as="style" href="{{ Vite::asset('resources/sass/styles-dark.scss', 'vendor/horizon') }}" /> | ||
<link rel="stylesheet" href="{{ Vite::asset('resources/sass/styles-dark.scss', 'vendor/horizon') }}" data-scheme="dark" /> | ||
{{ Laravel\Horizon\Horizon::css() }} | ||
{{ Laravel\Horizon\Horizon::js() }} | ||
</head> | ||
<body> | ||
<div id="horizon" v-cloak> | ||
|
@@ -127,12 +118,6 @@ | |
</div> | ||
|
||
<div class="col-10"> | ||
@if (! $assetsAreCurrent) | ||
<div class="alert alert-warning"> | ||
The published Horizon assets are not up-to-date with the installed version. To update, run:<br/><code>php artisan horizon:publish</code> | ||
</div> | ||
@endif | ||
|
||
Comment on lines
-130
to
-135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assets are always up to date ✌️ |
||
@if ($isDownForMaintenance) | ||
<div class="alert alert-warning"> | ||
This application is in "maintenance mode". Queued jobs may not be processed unless your worker is using the "force" flag. | ||
|
@@ -144,15 +129,5 @@ | |
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- Global Horizon Object --> | ||
<script> | ||
window.Horizon = @json($horizonScriptVariables); | ||
</script> | ||
|
||
@vite('resources/js/app.js', 'vendor/horizon') | ||
</body> | ||
</html> | ||
@php | ||
Vite::useHotFile($previousHotFile); | ||
@endphp |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,3 @@ workbench: | |
- db-wipe | ||
- migrate-fresh | ||
assets: [] | ||
sync: | ||
- from: ./public | ||
to: public/vendor/horizon |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import vue2 from '@vitejs/plugin-vue2'; | ||
|
||
/** @type {import('vite').UserConfig} */ | ||
export default { | ||
plugins: [vue2()], | ||
build: { | ||
assetsDir: '', | ||
rollupOptions: { | ||
input: ['resources/js/app.js', 'resources/sass/styles.scss', 'resources/sass/styles-dark.scss'], | ||
output: { | ||
entryFileNames: '[name].js', | ||
chunkFileNames: '[name].js', | ||
assetFileNames: '[name].[ext]', | ||
}, | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
'@': '/resources/js', | ||
}, | ||
}, | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StyleCI was having issues with the files in
dist
.I've copied this config from their docs (this is what is configured with
js: true
orcss: true
and addeddist
to the exclude.