feat: move all css to includes dir
This commit is contained in:
parent
408e859ef4
commit
6a84af0c37
29 changed files with 4 additions and 4 deletions
49
src/includes/css/styles.11ty.js
Normal file
49
src/includes/css/styles.11ty.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Implementation sourced from eleventyone starter kit
|
||||
* https://github.com/philhawksworth/eleventyone
|
||||
* ---
|
||||
* https://github.com/philhawksworth/eleventyone/blob/master/src/site/css/styles.11ty.js
|
||||
*/
|
||||
|
||||
import fs from "fs";
|
||||
import postcss from "postcss";
|
||||
import postcssImport from "postcss-import";
|
||||
import postcssImportExtGlob from "postcss-import-ext-glob";
|
||||
import autoprefixer from "autoprefixer";
|
||||
import cssnano from "cssnano";
|
||||
import { posix as path } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
import colors from "../../css-utils/colors.js";
|
||||
import fontFamily from "../../css-utils/font-family.js";
|
||||
import fontVariables from "../../css-utils/font-variables.js";
|
||||
import spacing from "../../css-utils/spacing.js";
|
||||
|
||||
export default class {
|
||||
async data() {
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const rawFilepath = path.join(dirname, "./global.css");
|
||||
const rawCss = fs.readFileSync(rawFilepath);
|
||||
|
||||
const css = `${rawCss}${fontFamily}${fontVariables}${colors}${spacing}`;
|
||||
|
||||
return {
|
||||
permalink: `css/styles.css`,
|
||||
excludeFromSitemap: true,
|
||||
eleventyExcludeFromCollections: true,
|
||||
rawFilepath,
|
||||
rawCss: css,
|
||||
};
|
||||
}
|
||||
|
||||
async render({ rawCss, rawFilepath }) {
|
||||
return await postcss([
|
||||
postcssImportExtGlob,
|
||||
postcssImport,
|
||||
autoprefixer,
|
||||
cssnano,
|
||||
])
|
||||
.process(rawCss, { from: rawFilepath })
|
||||
.then((result) => result.css);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue