Skip to content

Commit

Permalink
Update dependencies and change css modules scoped names
Browse files Browse the repository at this point in the history
  • Loading branch information
yhdgms1 committed Feb 21, 2022
1 parent 0a54a0f commit 7fe021d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@
</div>
</main>
<footer></footer>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"devDependencies": {
"malinajs-unplugin": "^0.0.18",
"vite": "^2.7.12",
"vite-plugin-html": "^2.1.2",
"vite-plugin-inspect": "^0.3.13",
"murmurhash-es": "^0.1.1",
"vite": "^2.8.4",
"vite-plugin-html": "3.0.6",
"vite-plugin-singlefile": "^0.6.3"
},
"dependencies": {
Expand Down
9 changes: 5 additions & 4 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ const i18n = rosetta(dict);

const isRussian = navigator.language.toLowerCase().includes("ru");

document.documentElement.setAttribute("lang", isRussian ? "ru" : "en");

if (!isRussian) {
document.title = "Let me Google that for you";
document.documentElement.setAttribute("lang", "en");
}

i18n.locale(isRussian ? "ru" : "en");
const { t, locale } = i18n;

locale(isRussian ? "ru" : "en");

export const { t, locale, set, table } = i18n;
export { t, locale };
24 changes: 18 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defineConfig } from "vite";
import { viteSingleFile } from "vite-plugin-singlefile";
import { minifyHtml } from "vite-plugin-html";
import { createHtmlPlugin } from "vite-plugin-html";
import { vitePlugin as malinaPlugin } from "malinajs-unplugin";
import { default as inspectPlugin } from "vite-plugin-inspect";
import { murmurHashV3 } from "murmurhash-es";

export default defineConfig(({ mode }) => {
const DEV = mode === "development";
Expand All @@ -13,17 +13,29 @@ export default defineConfig(({ mode }) => {
debugLabel: DEV,
}),
viteSingleFile(),
minifyHtml(),
inspectPlugin(),
createHtmlPlugin({
minify: true,
entry: "src/main.ts",
}),
],
build: {
minify: "terser",
target: ["chrome64"],
polyfillModulePreload: false,
cssCodeSplit: false,
rollupOptions: {
inlineDynamicImports: true,
output: {
manualChunks: () => "everything.js",
inlineDynamicImports: true,
manualChunks: null,
},
},
},
css: {
modules: {
generateScopedName: (name, filename, css) => {
const hash = murmurHashV3(name + filename, 0x9747b28c).toString(36);

return mode === "development" ? `${name}_${hash}` : `_${hash}`;
},
},
},
Expand Down
16 changes: 0 additions & 16 deletions windicss.config.ts

This file was deleted.

0 comments on commit 7fe021d

Please sign in to comment.