@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 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 href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
11
- <link rel="stylesheet" href="/src/index.css" />
12
- <link rel="stylesheet" media="screen" href="/src/screen.css" />
13
- <link rel="stylesheet" media="print" href="/src/print.css" />
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berlysia/vertical-writing-slide-system",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vertical-slides": "./cli.js"
package/src/index.css CHANGED
@@ -1,3 +1,6 @@
1
+ @import "screen.css" screen;
2
+ @import "print.css" print;
3
+
1
4
  * {
2
5
  box-sizing: border-box;
3
6
  }
package/src/main.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { StrictMode } from "react";
2
2
  import { createRoot } from "react-dom/client";
3
3
  import App from "./App.tsx";
4
+ import "./index.css";
4
5
 
5
6
  createRoot(document.getElementById("root")!).render(
6
7
  <StrictMode>
@@ -322,15 +322,21 @@ export default async function slidesPlugin(
322
322
  }
323
323
  },
324
324
 
325
- generateBundle(options, bundle) {
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 file in the bundle
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/main-") && fileName.endsWith(".js"),
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>