chore(*): use prettier for formatting
This commit is contained in:
parent
6c659fe1d0
commit
029caaaa9e
73 changed files with 1390 additions and 794 deletions
|
@ -1,24 +1,23 @@
|
|||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import postcss from "postcss";
|
||||
import postcssImport from "postcss-import";
|
||||
import postcssImportExtGlob from "postcss-import-ext-glob";
|
||||
import cssnano from "cssnano";
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import postcss from 'postcss';
|
||||
import postcssImport from 'postcss-import';
|
||||
import postcssImportExtGlob from 'postcss-import-ext-glob';
|
||||
import cssnano from 'cssnano';
|
||||
|
||||
export const cssConfig = (eleventyConfig) => {
|
||||
eleventyConfig.addTemplateFormats("css");
|
||||
eleventyConfig.addExtension("css", {
|
||||
outputFileExtension: "css",
|
||||
eleventyConfig.addTemplateFormats('css');
|
||||
eleventyConfig.addExtension('css', {
|
||||
outputFileExtension: 'css',
|
||||
compile: async (inputContent, inputPath) => {
|
||||
const outputPath = "dist/assets/css/index.css";
|
||||
const outputPath = 'dist/assets/css/index.css';
|
||||
|
||||
if (inputPath.endsWith("index.css")) {
|
||||
if (inputPath.endsWith('index.css')) {
|
||||
return async () => {
|
||||
let result = await postcss([
|
||||
postcssImportExtGlob,
|
||||
postcssImport,
|
||||
cssnano,
|
||||
]).process(inputContent, { from: inputPath });
|
||||
let result = await postcss([postcssImportExtGlob, postcssImport, cssnano]).process(
|
||||
inputContent,
|
||||
{ from: inputPath }
|
||||
);
|
||||
|
||||
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
||||
await fs.writeFile(outputPath, result.css);
|
||||
|
@ -26,6 +25,6 @@ export const cssConfig = (eleventyConfig) => {
|
|||
return result.css;
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue