brisa-tailwindcss 0.0.228 → 0.0.230

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.
Files changed (3) hide show
  1. package/index.d.ts +20 -3
  2. package/index.ts +6 -5
  3. package/package.json +4 -6
package/index.d.ts CHANGED
@@ -1,5 +1,22 @@
1
- export default function brisaTailwindcss(): {
1
+ /**
2
+ * To properly integrate TailwindCSS, you have to add the following code to
3
+ * your `brisa.config.ts` file:
4
+ *
5
+ * ```ts
6
+ * import tailwindCSS from 'brisa-tailwindcss';
7
+ *
8
+ * export default {
9
+ * integrations: [tailwindCSS()],
10
+ * };
11
+ * ```
12
+ *
13
+ * - [Docs](https://brisa.build/building-your-application/integrations/tailwind-css#integrating-tailwind-css)
14
+ */
15
+ export default function tailwindCSS(): {
2
16
  name: string;
3
- transpileCSS(pathname: string): Promise<string>;
4
- defaultCSSContent: string;
17
+ transpileCSS(pathname: string, content: string): Promise<string>;
18
+ defaultCSS: {
19
+ content: string;
20
+ applyDefaultWhenEvery: (content: string) => boolean;
21
+ };
5
22
  };
package/index.ts CHANGED
@@ -1,20 +1,21 @@
1
1
  import tailwindcss from '@tailwindcss/postcss';
2
- import fs from 'node:fs';
3
2
  import postcss from 'postcss';
4
3
 
5
4
  // Note: is not bundled here to avoid issues with lightningcss
6
5
  export default function brisaTailwindcss() {
7
6
  return {
8
7
  name: 'brisa-tailwindcss',
9
- async transpileCSS(pathname: string) {
10
- const content = fs.readFileSync(pathname, 'utf-8');
8
+ async transpileCSS(pathname: string, content: string) {
11
9
  const transpiledContent = await postcss([tailwindcss]).process(content, {
12
10
  from: pathname,
13
11
  });
14
12
  // Add :host to all :root selectors to support shadow DOM
15
13
  return transpiledContent.css.replaceAll(':root', ':root, :host');
16
14
  },
17
- defaultCSSContent:
18
- '@tailwind base;\n@tailwind components;\n@tailwind utilities;',
15
+ defaultCSS: {
16
+ content: '@tailwind base;\n@tailwind components;\n@tailwind utilities;',
17
+ applyDefaultWhenEvery: (content: string) =>
18
+ !content.includes('@tailwind'),
19
+ },
19
20
  };
20
21
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "brisa-tailwindcss",
3
- "version": "0.0.228",
3
+ "version": "0.0.230",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "main": "./index.js",
7
- "module": "./index.js",
6
+ "main": "./index.ts",
7
+ "module": "./index.ts",
8
8
  "types": "./index.d.ts",
9
9
  "author": "Aral Roca Gòmez <contact@aralroca.com>",
10
10
  "repository": {
@@ -15,9 +15,7 @@
15
15
  "files": ["index.ts", "index.d.ts"],
16
16
  "dependencies": {
17
17
  "@tailwindcss/postcss": "4.0.0-alpha.21",
18
- "postcss": "8.4.47"
19
- },
20
- "peerDependencies": {
18
+ "postcss": "8.4.47",
21
19
  "tailwindcss": "4.0.0-alpha.21"
22
20
  },
23
21
  "packageManager": "bun@1.1.30",