mirror of
https://github.com/bitwarden/clients.git
synced 2026-11-16 07:03:29 +00:00
[CL-1141] Improve tailwind config structure across apps and libs (#20102)
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const path = require("path");
|
||||
|
||||
const config = require("../../libs/components/tailwind.config.base");
|
||||
|
||||
config.content = [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/assets/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts}",
|
||||
"../../libs/angular/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts}",
|
||||
"../../libs/pricing/src/**/*.{html,ts}",
|
||||
];
|
||||
// Add browser-specific paths here. Shared libs should go in tailwind.config.base.js instead
|
||||
const browserContent = [path.resolve(__dirname, "./src/**/*.{html,ts,mdx}")];
|
||||
|
||||
config.content = [...config.content, ...browserContent];
|
||||
config.browserContent = browserContent;
|
||||
config.corePlugins.preflight = true;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const path = require("path");
|
||||
|
||||
const config = require("../../libs/components/tailwind.config.base");
|
||||
|
||||
config.content = [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/assets/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/angular/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/pricing/src/**/*.{html,ts}",
|
||||
"../../libs/tools/send/send-ui/src/**/*.{html,ts}",
|
||||
];
|
||||
// Add desktop-specific paths here. Shared libs should go in tailwind.config.base.js instead
|
||||
const desktopContent = [path.resolve(__dirname, "./src/**/*.{html,ts,mdx}")];
|
||||
|
||||
config.content = [...config.content, ...desktopContent];
|
||||
config.desktopContent = desktopContent;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
|
||||
const path = require("path");
|
||||
|
||||
const config = require("../../libs/components/tailwind.config.base");
|
||||
|
||||
config.content = [
|
||||
path.resolve(__dirname, "./src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/components/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/assets/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/auth/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/key-management-ui/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/vault/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/angular/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/tools/generator/components/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../libs/tools/send/send-ui/src/**/*.{html,ts}"),
|
||||
path.resolve(__dirname, "../../bitwarden_license/bit-web/src/**/*.{html,ts}"),
|
||||
// Add web-specific paths here. Shared libs should go in tailwind.config.base.js instead
|
||||
const webContent = [
|
||||
path.resolve(__dirname, "./src/**/*.{html,ts,mdx}"),
|
||||
path.resolve(__dirname, "../../bitwarden_license/bit-web/src/**/*.{html,ts,mdx}"),
|
||||
];
|
||||
|
||||
config.content = [...config.content, ...webContent];
|
||||
config.webContent = webContent;
|
||||
config.corePlugins.preflight = true;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
/* eslint-disable */
|
||||
const colors = require("tailwindcss/colors");
|
||||
const plugin = require("tailwindcss/plugin");
|
||||
const path = require("path");
|
||||
|
||||
function rgba(color) {
|
||||
return "rgb(var(" + color + ") / <alpha-value>)";
|
||||
}
|
||||
|
||||
// shared lib paths; add app-specific paths to the app's tailwind.config.js, not here
|
||||
const libContent = [
|
||||
"./src/**/*.{html,ts,mdx}",
|
||||
"../../libs/admin-console/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/angular/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/assets/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/auth/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/billing/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/dirt/card/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/platform/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/pricing/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/subscription/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/tools/generator/components/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/tools/send/send-ui/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/vault/src/**/*.{html,ts,mdx}",
|
||||
].map((libPath) => path.resolve(__dirname, libPath));
|
||||
|
||||
module.exports = {
|
||||
prefix: "tw-",
|
||||
content: [
|
||||
"./src/**/*.{html,ts,mdx}",
|
||||
"../../libs/assets/src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts,mdx}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
],
|
||||
content: libContent,
|
||||
safelist: [],
|
||||
corePlugins: { preflight: false },
|
||||
theme: {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/* eslint-disable */
|
||||
const config = require("./tailwind.config.base");
|
||||
|
||||
config.content = [
|
||||
"libs/components/src/**/*.{html,ts,mdx}",
|
||||
"libs/assets/src/**/*.{html,ts,mdx}",
|
||||
"libs/auth/src/**/*.{html,ts,mdx}",
|
||||
"libs/vault/src/**/*.{html,ts,mdx}",
|
||||
"apps/web/src/**/*.{html,ts,mdx}",
|
||||
"apps/browser/src/**/*.{html,ts,mdx}",
|
||||
"bitwarden_license/bit-web/src/**/*.{html,ts,mdx}",
|
||||
".storybook/preview.tsx",
|
||||
];
|
||||
|
||||
// Safelist is required for dynamic color classes in Storybook color documentation (colors.mdx).
|
||||
// Tailwind's JIT compiler cannot detect dynamically constructed class names like `tw-bg-${name}`,
|
||||
// so we must explicitly safelist these patterns to ensure all color utilities are generated.
|
||||
config.safelist = [
|
||||
{
|
||||
pattern: /tw-bg-(.*)/,
|
||||
},
|
||||
];
|
||||
|
||||
config.corePlugins.preflight = true;
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,24 +1,34 @@
|
||||
/* eslint-disable */
|
||||
const config = require("./libs/components/tailwind.config.base");
|
||||
const path = require("path");
|
||||
|
||||
const config = require("./libs/components/tailwind.config.base");
|
||||
const webConfig = require("./apps/web/tailwind.config");
|
||||
const browserConfig = require("./apps/browser/tailwind.config");
|
||||
const desktopConfig = require("./apps/desktop/tailwind.config");
|
||||
|
||||
/**
|
||||
* Pull together all the tailwind configs for the shared libs and clients for use in Storybook.
|
||||
*
|
||||
* Do not add new paths here directly. Add shared libs to tailwind.config.base.js, and add
|
||||
* app-specific paths to their respective tailwind.config.js file
|
||||
*/
|
||||
config.content = [
|
||||
"./libs/components/src/**/*.{html,ts,mdx}",
|
||||
"./libs/admin-console/src/**/*.{html,ts,mdx}",
|
||||
"./libs/auth/src/**/*.{html,ts,mdx}",
|
||||
"./libs/billing/src/**/*.{html,ts,mdx}",
|
||||
"./libs/assets/src/**/*.{html,ts}",
|
||||
"./libs/platform/src/**/*.{html,ts,mdx}",
|
||||
"./libs/pricing/src/**/*.{html,ts,mdx}",
|
||||
"./libs/tools/send/send-ui/src/*.{html,ts,mdx}",
|
||||
"./libs/vault/src/**/*.{html,ts,mdx}",
|
||||
"./apps/web/src/**/*.{html,ts,mdx}",
|
||||
"./bitwarden_license/bit-web/src/**/*.{html,ts,mdx}",
|
||||
"./.storybook/preview.js",
|
||||
...config.content,
|
||||
...webConfig.webContent,
|
||||
...browserConfig.browserContent,
|
||||
...desktopConfig.desktopContent,
|
||||
path.resolve(__dirname, ".storybook/preview.tsx"),
|
||||
];
|
||||
|
||||
// Safelist is required for dynamic color classes in Storybook color documentation (colors.mdx).
|
||||
// Tailwind's JIT compiler cannot detect dynamically constructed class names like `tw-bg-${name}`,
|
||||
// so we must explicitly safelist these patterns to ensure all color utilities are generated.
|
||||
config.safelist = [
|
||||
{
|
||||
pattern: /tw-bg-(.*)/,
|
||||
},
|
||||
];
|
||||
|
||||
config.corePlugins.preflight = true;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
Reference in New Issue
Block a user