Skip to content

Commit

Permalink
Max performance 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
issam-seghir committed Dec 14, 2023
1 parent 61d280f commit 4974aa6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 69 deletions.
7 changes: 5 additions & 2 deletions src/jsx/components/Hemlet/Preload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { useTheme } from "@mui/joy/styles";
export default function Preload() {
const theme = useTheme();
const isDark = theme.palette.mode === "dark";
const preloadGifDark = "src/assets/gifs/giphy-downsized.gif";
const preloadGifLight = "src/assets/gifs/looking-water.gif";
// Define paths based on environment
const preloadGifDark = import.meta.env.DEV ? "src/assets/gifs/giphy-downsized.gif" : "giphy-downsized.gif"; // Adjust the paths accordingly for production

const preloadGifLight = import.meta.env.DEV ? "src/assets/gifs/looking-water.gif" : "looking-water.gif"; // Adjust the paths accordingly for production

return (
<Helmet>
<link rel="preload" href={isDark ? preloadGifDark : preloadGifLight} as="image" />
Expand Down
58 changes: 0 additions & 58 deletions tsconfig.json

This file was deleted.

24 changes: 15 additions & 9 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ export default defineConfig(({ command, mode, ssrBuild }) => ({
// Getting rid of hashes in generated filenames
filenameHashing: true,
build: {
sourcemap: true,
// cssMinify: false, // disable CSS minify only
// minify: false, // disable CSS/JS minify only
// change output location
// rollupOptions: {
// output: {
// manualChunks: undefined,
// assetFileNames: "assets/[name].[ext]", // Output assets (e.g., images, SVGs) to the assets folder
// entryFileNames: "assets/[name].js", // Output entry files (e.g., JavaScript) to the root directory
// chunkFileNames: "assets/[name].[ext]", // Output dynamic imports (chunks) to the assets folder
// },
// },
rollupOptions: {
output: {
// manualChunks: undefined,
// assetFileNames: "assets/[name].[ext]", // Output assets (e.g., images, SVGs) to the assets folder
// entryFileNames: "assets/[name].js", // Output entry files (e.g., JavaScript) to the root directory
// chunkFileNames: "assets/[name].[ext]", // Output dynamic imports (chunks) to the assets folder
// Exclude all GIF files from being hashed
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith(".gif")) {
return "[name].[ext]";
}
return `[name].[hash].[ext]`;
},
},
},
},

server: {
Expand Down

0 comments on commit 4974aa6

Please sign in to comment.