mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-05 16:42:29 +03:00
a8ab19955b
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com> Co-authored-by: Mark Otto <markdotto@gmail.com>
23 lines
570 B
JavaScript
23 lines
570 B
JavaScript
import { getConfig } from '../libs/config.ts'
|
|
|
|
/**
|
|
* Vite plugin to replace placeholder values in stackblitz.js with actual configuration values
|
|
*/
|
|
export function stackblitzPlugin() {
|
|
const config = getConfig()
|
|
|
|
return {
|
|
name: 'stackblitz-config-replacer',
|
|
transform(code, id) {
|
|
if (id.includes('stackblitz.js')) {
|
|
return code
|
|
.replace(/__CSS_CDN__/g, config.cdn.css)
|
|
.replace(/__JS_BUNDLE_CDN__/g, config.cdn.js_bundle)
|
|
.replace(/__DOCS_VERSION__/g, config.docs_version)
|
|
}
|
|
|
|
return code
|
|
}
|
|
}
|
|
}
|