@baybreezy/docd 0.0.2 → 0.0.3

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.
@@ -1,5 +1,6 @@
1
- @import "tailwindcss" source("../../../../../");
1
+ @import "tailwindcss";
2
2
  @import "tw-animate-css";
3
+ @source "../../../../";
3
4
 
4
5
  @config "../../../tailwind.config.cjs";
5
6
 
package/modules/css.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { addVitePlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
2
+ import { joinURL } from "ufo";
3
+
4
+ export default defineNuxtModule({
5
+ meta: {
6
+ name: "docd:css",
7
+ },
8
+ setup(_options, nuxt) {
9
+ const resolver = createResolver(import.meta.url);
10
+
11
+ // Absolute path to the layer's tailwind entry — this is the file that owns
12
+ // `@import "tailwindcss"` and therefore controls Tailwind's scanner.
13
+ const tailwindCssPath = resolver.resolve("../app/assets/css/tailwind.css");
14
+
15
+ // The consuming app's content directory. We convert to forward-slashes so
16
+ // the injected @source glob works on Windows too.
17
+ const contentDir = joinURL(nuxt.options.rootDir, "content").replace(/\\/g, "/");
18
+
19
+ // Inject `@source <contentDir>/**/*` into tailwind.css
20
+ addVitePlugin({
21
+ name: "docd:inject-tailwind-sources",
22
+ enforce: "pre",
23
+ transform(code: string, id: string) {
24
+ if (id.split("?")[0] !== tailwindCssPath) return null;
25
+ return {
26
+ code: `${code}\n@source ${JSON.stringify(`${contentDir}/**/*`)};`,
27
+ map: null,
28
+ };
29
+ },
30
+ });
31
+
32
+ // Suppress noisy Vite warnings produced during Tailwind's build pass.
33
+ nuxt.hook("vite:extendConfig", (config) => {
34
+ const logger = config.customLogger;
35
+ if (!logger) return;
36
+ const ignore = ["@tailwindcss/vite:generate:build", "nuxt:module-preload-polyfill"];
37
+ const originalWarn = logger.warn.bind(logger);
38
+ logger.warn = (msg, options) => {
39
+ if (ignore.some((p) => msg.includes(p))) return;
40
+ originalWarn(msg, options);
41
+ };
42
+ });
43
+ },
44
+ });
package/nuxt.config.ts CHANGED
@@ -50,6 +50,7 @@ export default defineNuxtConfig({
50
50
  "@morev/vue-transitions/nuxt",
51
51
  "vue-sonner/nuxt",
52
52
  resolver.resolve("./modules/routing"),
53
+ resolver.resolve("./modules/css"),
53
54
  resolver.resolve("./modules/config"),
54
55
  resolver.resolve("./modules/custom-icons"),
55
56
  resolver.resolve("./modules/prose-component-meta"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baybreezy/docd",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A Nuxt layer for building documentation sites with UI Thing.",
5
5
  "repository": {
6
6
  "type": "git",