Skip to content
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

Improve JS loading #335

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

33 changes: 0 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
"@docsearch/js": "^3.3.3",
"alpinejs": "^3.7.1",
"autoprefixer": "^10.4.14",
"babel-plugin-prismjs": "^2.0.1",
"clipboard": "^2.0.10",
"laravel-vite-plugin": "^0.7.6",
"postcss": "^8.4.21",
"postcss-import": "^14.0.0",
"prismjs": "^1.22.0",
"tailwindcss": "^3.3.0",
"vite": "^4.3.9"
}
Expand Down
1 change: 0 additions & 1 deletion public/build/assets/accessibility-1f45336a.js

This file was deleted.

29 changes: 0 additions & 29 deletions public/build/assets/app-2c9b9d45.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/app-409e9bd3.css

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/app-416e1687.css

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions public/build/assets/app-f72b41bb.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions public/build/assets/docs-59af3d22.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions public/build/assets/docs-80215298.js

This file was deleted.

20 changes: 4 additions & 16 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/css/app.css": {
"file": "assets/app-409e9bd3.css",
"file": "assets/app-416e1687.css",
"isEntry": true,
"src": "resources/css/app.css"
},
Expand Down Expand Up @@ -37,25 +37,13 @@
"src": "resources/images/vacation.svg"
},
"resources/js/app.js": {
"dynamicImports": [
"resources/js/docs.js",
"resources/js/components/accessibility.js"
],
"file": "assets/app-2c9b9d45.js",
"file": "assets/app-f72b41bb.js",
"isEntry": true,
"src": "resources/js/app.js"
},
"resources/js/components/accessibility.js": {
"file": "assets/accessibility-1f45336a.js",
"isDynamicEntry": true,
"src": "resources/js/components/accessibility.js"
},
"resources/js/docs.js": {
"file": "assets/docs-80215298.js",
"imports": [
"resources/js/app.js"
],
"isDynamicEntry": true,
"file": "assets/docs-59af3d22.js",
"isEntry": true,
"src": "resources/js/docs.js"
}
}
18 changes: 9 additions & 9 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Alpine from 'alpinejs';
import Focus from '@alpinejs/focus';

import './clipboard';
import './components/search';
Comment on lines -3 to -5
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are loaded via docs.js as they are not needed on non-docs pages.

import docsearch from '@docsearch/js';

import.meta.glob([
'../images/**',
Expand All @@ -13,10 +11,12 @@ window.Alpine = Alpine;
Alpine.plugin(Focus);
Alpine.start();

document.addEventListener('DOMContentLoaded', () => {
if (document.querySelector('#docsScreen')) {
import('./docs.js');
}

import('./components/accessibility');
docsearch({
container: '#docsearch',
appId: algolia_app_id,
apiKey: algolia_search_key,
indexName: 'laravel',
searchParameters: {
facetFilters: ['version:' + window.version],
},
});
Loading