@berlysia/vertical-writing-slide-system 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +5 -0
- package/index.html +6 -6
- package/package.json +1 -1
- package/src/index.css +3 -0
- package/src/main.tsx +1 -0
- package/src/vite-plugin-slides.ts +14 -3
package/cli.js
CHANGED
|
@@ -36,7 +36,12 @@ async function runBuild() {
|
|
|
36
36
|
outDir: resolve(process.cwd(), "pages"),
|
|
37
37
|
rollupOptions: {
|
|
38
38
|
input: resolve(import.meta.dirname, "src/main.tsx"),
|
|
39
|
+
output: {
|
|
40
|
+
assetFileNames: "assets/[name]-[hash][extname]",
|
|
41
|
+
},
|
|
39
42
|
},
|
|
43
|
+
cssCodeSplit: true,
|
|
44
|
+
assetsInlineLimit: 0,
|
|
40
45
|
},
|
|
41
46
|
});
|
|
42
47
|
} catch (error) {
|
package/index.html
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vite + React + TS</title>
|
|
8
|
-
<link rel="preconnect" href="https://fonts.googleapis.com"
|
|
9
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin
|
|
10
|
-
<link
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&family=Noto+Sans+Mono:wght@100..900&display=swap"
|
|
12
|
+
rel="stylesheet"
|
|
13
|
+
/>
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
package/package.json
CHANGED
package/src/index.css
CHANGED
package/src/main.tsx
CHANGED
|
@@ -322,15 +322,21 @@ export default async function slidesPlugin(
|
|
|
322
322
|
}
|
|
323
323
|
},
|
|
324
324
|
|
|
325
|
-
generateBundle(
|
|
325
|
+
generateBundle(_options, bundle) {
|
|
326
326
|
// Generate HTML file if none exists in consumer project
|
|
327
327
|
const consumerIndexHtml = path.resolve(resolvedConfig.root, "index.html");
|
|
328
328
|
|
|
329
329
|
if (!fs.existsSync(consumerIndexHtml)) {
|
|
330
|
-
// Find the main JS
|
|
330
|
+
// Find the main JS and CSS files in the bundle
|
|
331
331
|
const mainJsFile = Object.keys(bundle).find(
|
|
332
332
|
(fileName) =>
|
|
333
|
-
fileName.startsWith("assets/
|
|
333
|
+
fileName.startsWith("assets/") &&
|
|
334
|
+
fileName.includes("main-") &&
|
|
335
|
+
fileName.endsWith(".js"),
|
|
336
|
+
);
|
|
337
|
+
const mainCssFile = Object.keys(bundle).find(
|
|
338
|
+
(fileName) =>
|
|
339
|
+
fileName.startsWith("assets/") && fileName.endsWith(".css"),
|
|
334
340
|
);
|
|
335
341
|
|
|
336
342
|
if (!mainJsFile) {
|
|
@@ -338,6 +344,10 @@ export default async function slidesPlugin(
|
|
|
338
344
|
return;
|
|
339
345
|
}
|
|
340
346
|
|
|
347
|
+
const cssLink = mainCssFile
|
|
348
|
+
? `<link rel="stylesheet" href="./${mainCssFile}">`
|
|
349
|
+
: "<!-- CSS is included in the JS bundle -->";
|
|
350
|
+
|
|
341
351
|
const virtualIndexHtml = `<!doctype html>
|
|
342
352
|
<html lang="ja">
|
|
343
353
|
<head>
|
|
@@ -347,6 +357,7 @@ export default async function slidesPlugin(
|
|
|
347
357
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
348
358
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
349
359
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
|
360
|
+
${cssLink}
|
|
350
361
|
</head>
|
|
351
362
|
<body>
|
|
352
363
|
<div id="root"></div>
|