-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom PostCSS plugins in CSS plugin #26
Conversation
plugins/css.js
Outdated
export default function (plugins = []) { | ||
return (site) => { | ||
const runner = postcss([ | ||
postcssImport({ | ||
path: site.src("_includes"), | ||
}), | ||
postcssNesting(), | ||
...plugins, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about instead having the nesting be inside the plugins = []
because some people may not like that. We could move the import plugin, but since that requires some special configuration it makes sense to keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think nesting should be left out of the default and left up to the user to add. I kept it in my PR considering there may be existing setups relying on nesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
It successfully works with these plugins: import css from "./css.js";
// import css from "https://deno.land/x/lume/plugins/css.js";
import pfm from "https://esm.sh/postcss-font-magician";
import autoprefixer from "https://esm.sh/autoprefixer";
import presetEnv from "https://esm.sh/postcss-preset-env";
import csso from "https://esm.sh/postcss-csso";
site.use(css([pfm(), autoprefixer(), presetEnv(), csso()])); |
@ewired Pretty nice, but I believe |
Hi, thanks for this contribution. In previous versions of Lume, the css plugin includes also presetEnv, but it was removed in 0.9.12 (v0.9.11...v0.9.12) because the versions automatically converted by jspm.dev started to fail. My initial idea for this plugin was to be library agnostic. I mean, internally it uses postcss, but in the future it could switch to other library (In fact, initially it was using stylecow), so the user only need to know that using it, the css will be loaded, fixed, optimized and that's all. This is why the plugin name is just But, that being said, I see that the ability to configure this plugin is useful so I'm okay with this proposal. The only change I'd recommend is use an object, so we can add more options in the future. For example: site.use(css({
postcssPlugins: [autoprefixer(), csso()]
})); And about the nesting plugin, I'm agree with @shadowtime2000 that it should be used in the default plugin config but it should be able to be removed (for example, |
Thanks! 👍 |
No description provided.