I’m trying to use the postcss-lab-function
module to convert LCH colors in my CSS code, but I can’t seem to get it working. In my <head>
partial, I have:
{{ $postCSSOptions := dict "config" "./postcss.config.js" "use" "postcss-lab-function" }}
{{ with resources.Get "css/colors.css" | resources.PostCSS $postCSSOptions | fingerprint "sha512" }}
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
In postcss.config.js
I have (according to their docs):
const postcssLabFunction = require('postcss-lab-function');
module.exports = {
plugins: [
postcssLabFunction(
preserve: true
),
],
};
And then in assets/css/colors.css
I have:
:root {
--background-0: lch(5, 0, 0);
}
But if I look at the stylesheet tab on Firefox DevTools, I just see the raw lch
command in the CSS, which didn’t get changed at all. What am I doing wrong?