Skip to content
Draft
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
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export default [
{
files: [
'site/src/assets/application.js',
'site/src/assets/bootstrap.bundle.js',
'site/src/assets/partials/*.js',
'site/src/assets/search.js',
'site/src/assets/snippets.js',
Expand Down
3 changes: 3 additions & 0 deletions site/src/assets/bootstrap.bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as bootstrapBundle from '../../../dist/js/bootstrap.bundle.js'

Object.keys(bootstrapBundle)
3 changes: 3 additions & 0 deletions site/src/components/Scripts.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
import { getVersionedBsJsProps } from '@libs/bootstrap'
import type { Layout } from '@libs/layout'
import DocsScripts from './DocsScripts.astro'

Expand All @@ -9,6 +10,8 @@ interface Props {
const { layout } = Astro.props
---

<script is:inline {...getVersionedBsJsProps()}></script>

<script src="../assets/application.js"></script>
<script src="../assets/search.js"></script>

Expand Down
7 changes: 7 additions & 0 deletions site/src/libs/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export function getVersionedBsCssProps(direction: 'rtl' | undefined) {
export function getVersionedBsJsProps() {
let bsJsScriptSrc = '/dist/js/bootstrap.bundle'

if (import.meta.env.DEV) {
return {
type: 'module',
src: '/src/assets/bootstrap.bundle.js'
} satisfies HTMLAttributes<'script'>
}

if (import.meta.env.PROD) {
bsJsScriptSrc = `${bsJsScriptSrc}.min`
}
Expand Down
Loading