-
-
Notifications
You must be signed in to change notification settings - Fork 79k
Expand file tree
/
Copy pathbootstrap.ts
More file actions
52 lines (39 loc) · 1.2 KB
/
bootstrap.ts
File metadata and controls
52 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import type { HTMLAttributes } from 'astro/types'
import { getConfig } from '@libs/config'
import { getVersionedDocsPath } from '@libs/path'
export function getVersionedBsCssProps(direction: 'rtl' | undefined) {
let bsCssLinkHref = '/dist/css/bootstrap'
if (import.meta.env.PROD) {
bsCssLinkHref = `${bsCssLinkHref}.min`
}
bsCssLinkHref = `${bsCssLinkHref}.css`
const bsCssLinkProps: HTMLAttributes<'link'> = {
href: getVersionedDocsPath(bsCssLinkHref),
rel: 'stylesheet'
}
if (import.meta.env.PROD) {
bsCssLinkProps.integrity = getConfig().cdn.css_hash
}
return bsCssLinkProps
}
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`
}
bsJsScriptSrc = `${bsJsScriptSrc}.js`
const bsJsLinkProps: HTMLAttributes<'script'> = {
type: 'module',
src: getVersionedDocsPath(bsJsScriptSrc)
}
if (import.meta.env.PROD) {
bsJsLinkProps.integrity = getConfig().cdn.js_bundle_hash
}
return bsJsLinkProps
}