➕ add TailwindCSS
+ a lot of node_modules?? unsure what happened
This commit is contained in:
parent
2ba37bfbe3
commit
bb41712ce4
1088 changed files with 224305 additions and 175 deletions
18
node_modules/@astrojs/tailwind/dist/index.d.ts
generated
vendored
Normal file
18
node_modules/@astrojs/tailwind/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
import type { AstroIntegration } from 'astro';
|
||||
type TailwindOptions = {
|
||||
/**
|
||||
* Path to your tailwind config file
|
||||
* @default 'tailwind.config.js'
|
||||
*/
|
||||
configFile?: string;
|
||||
/**
|
||||
* Apply Tailwind's base styles
|
||||
* Disabling this is useful when further customization of Tailwind styles
|
||||
* and directives is required. See {@link https://tailwindcss.com/docs/functions-and-directives#tailwind Tailwind's docs}
|
||||
* for more details on directives and customization.
|
||||
* @default true
|
||||
*/
|
||||
applyBaseStyles?: boolean;
|
||||
};
|
||||
export default function tailwindIntegration(options?: TailwindOptions): AstroIntegration;
|
||||
export {};
|
51
node_modules/@astrojs/tailwind/dist/index.js
generated
vendored
Normal file
51
node_modules/@astrojs/tailwind/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
import autoprefixerPlugin from "autoprefixer";
|
||||
import tailwindPlugin from "tailwindcss";
|
||||
async function getPostCssConfig(root, postcssInlineOptions) {
|
||||
let postcssConfigResult;
|
||||
if (!(typeof postcssInlineOptions === "object" && postcssInlineOptions !== null)) {
|
||||
let { default: postcssrc } = await import("postcss-load-config");
|
||||
const searchPath = typeof postcssInlineOptions === "string" ? postcssInlineOptions : root;
|
||||
try {
|
||||
postcssConfigResult = await postcssrc({}, searchPath);
|
||||
} catch (e) {
|
||||
postcssConfigResult = null;
|
||||
}
|
||||
}
|
||||
return postcssConfigResult;
|
||||
}
|
||||
async function getViteConfiguration(tailwindConfigPath, viteConfig) {
|
||||
var _a, _b;
|
||||
const postcssConfigResult = await getPostCssConfig(viteConfig.root, (_a = viteConfig.css) == null ? void 0 : _a.postcss);
|
||||
const postcssOptions = (postcssConfigResult == null ? void 0 : postcssConfigResult.options) ?? {};
|
||||
const postcssPlugins = ((_b = postcssConfigResult == null ? void 0 : postcssConfigResult.plugins) == null ? void 0 : _b.slice()) ?? [];
|
||||
postcssPlugins.push(tailwindPlugin(tailwindConfigPath));
|
||||
postcssPlugins.push(autoprefixerPlugin());
|
||||
return {
|
||||
css: {
|
||||
postcss: {
|
||||
options: postcssOptions,
|
||||
plugins: postcssPlugins
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function tailwindIntegration(options) {
|
||||
const applyBaseStyles = (options == null ? void 0 : options.applyBaseStyles) ?? true;
|
||||
const customConfigPath = options == null ? void 0 : options.configFile;
|
||||
return {
|
||||
name: "@astrojs/tailwind",
|
||||
hooks: {
|
||||
"astro:config:setup": async ({ config, updateConfig, injectScript }) => {
|
||||
updateConfig({
|
||||
vite: await getViteConfiguration(customConfigPath, config.vite)
|
||||
});
|
||||
if (applyBaseStyles) {
|
||||
injectScript("page-ssr", `import '@astrojs/tailwind/base.css';`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
tailwindIntegration as default
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue