Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Feb 11, 2025
1 parent c26403b commit eeb1d2e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 7 deletions.
55 changes: 48 additions & 7 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,48 @@ export default (await import("astro/config")).defineConfig({
},
vite: {
build: {
sourcemap: true,
sourcemap: On,
manifest: true,
minify: On ? false : "terser",
cssMinify: On ? false : "esbuild",
terserOptions: On
? {
compress: false,
ecma: 2020,
enclose: false,
format: {
ascii_only: false,
braces: false,
comments: false,
ie8: false,
indent_level: 4,
indent_start: 0,
inline_script: false,
keep_numbers: true,
keep_quoted_props: true,
max_line_len: 80,
preamble: null,
ecma: 5,
preserve_annotations: true,
quote_keys: false,
quote_style: 3,
safari10: true,
semicolons: true,
shebang: false,
shorthand: false,
webkit: true,
wrap_func_args: true,
wrap_iife: true,
},
sourceMap: true,
ie8: true,
keep_classnames: true,
keep_fnames: true,
mangle: false,
module: true,
toplevel: true,
}
: {},
},
resolve: {
preserveSymlinks: true,
Expand All @@ -44,24 +85,24 @@ export default (await import("astro/config")).defineConfig({
},
plugins: [
{
name: "crossorigin",
name: "CrossOrigin",
transform(Code, Identifier, _) {
const crossorigin = Identifier.includes(".js")
const CrossOrigin = Identifier.includes(".js")
? `crossorigin=\\"anonymous\\"`
: 'crossorigin="anonymous"';

return Code.replace(/<script/g, `<script ${crossorigin}`)
return Code.replace(/<script/g, `<script ${CrossOrigin}`)
.replace(
/<link[^>]*(?=.*rel="preload")(?=.*href="[^"]*\.js")(?=.*as="script")[^>]*/g,
`$& ${crossorigin}`,
`$& ${CrossOrigin}`,
)
.replace(
/<link[^>]*(?=.*rel="preload")(?=.*as="font")[^>]*/g,
`$& ${crossorigin}`,
`$& ${CrossOrigin}`,
)
.replace(
/<link[^>]*(?=.*rel="stylesheet")(?=.*href="https?:\/\/[^"]*")[^>]*/g,
`$& ${crossorigin}`,
`$& ${CrossOrigin}`,
);
},
},
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fontFamily } from "tailwindcss/defaultTheme";

/** @type {import('tailwindcss').Config} */
export default {
content: [
"./Public/**/*.html",
Expand Down

0 comments on commit eeb1d2e

Please sign in to comment.