fix: tailwind bg-clip-text not working (#2152)

This commit is contained in:
Marvin Hagemeister
2023-12-07 09:54:32 +01:00
committed by GitHub
parent 9af63be308
commit 2caf798016
3 changed files with 63 additions and 7 deletions
+8 -3
View File
@@ -2,7 +2,9 @@ import { ResolvedFreshConfig } from "../../server.ts";
import tailwindCss, { Config } from "tailwindcss";
import postcss from "npm:postcss@8.4.31";
import cssnano from "npm:cssnano@6.0.1";
import autoprefixer from "npm:autoprefixer@10.4.16";
import * as path from "https://deno.land/std@0.207.0/path/mod.ts";
import { TailwindPluginOptions } from "./types.ts";
const CONFIG_EXTENSIONS = ["ts", "js", "mjs"];
@@ -37,6 +39,7 @@ async function findTailwindConfigFile(directory: string): Promise<string> {
export async function initTailwind(
config: ResolvedFreshConfig,
options: TailwindPluginOptions,
): Promise<postcss.Processor> {
const root = path.dirname(config.staticDir);
@@ -60,9 +63,11 @@ export async function initTailwind(
});
// PostCSS types cause deep recursion
// deno-lint-ignore no-explicit-any
const plugins: any[] = [
tailwindCss(tailwindConfig),
const plugins = [
// deno-lint-ignore no-explicit-any
tailwindCss(tailwindConfig) as any,
// deno-lint-ignore no-explicit-any
autoprefixer(options.autoprefixer) as any,
];
if (!config.dev) {
+44
View File
@@ -0,0 +1,44 @@
export interface AutoprefixerOptions {
/** environment for `Browserslist` */
env?: string;
/** should Autoprefixer use Visual Cascade, if CSS is uncompressed */
cascade?: boolean;
/** should Autoprefixer add prefixes. */
add?: boolean;
/** should Autoprefixer [remove outdated] prefixes */
remove?: boolean;
/** should Autoprefixer add prefixes for @supports parameters. */
supports?: boolean;
/** should Autoprefixer add prefixes for flexbox properties */
flexbox?: boolean | "no-2009";
/** should Autoprefixer add IE 10-11 prefixes for Grid Layout properties */
grid?: boolean | "autoplace" | "no-autoplace";
/** custom usage statistics for > 10% in my stats browsers query */
stats?: {
[browser: string]: {
[version: string]: number;
};
};
/**
* list of queries for target browsers.
* Try to not use it.
* The best practice is to use `.browserslistrc` config or `browserslist` key in `package.json`
* to share target browsers with Babel, ESLint and Stylelint
*/
overrideBrowserslist?: string | string[];
/** do not raise error on unknown browser version in `Browserslist` config. */
ignoreUnknownVersions?: boolean;
}
export interface TailwindPluginOptions {
autoprefixer?: AutoprefixerOptions;
}