-
Notifications
You must be signed in to change notification settings - Fork 74
Load PostCSS config #33
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
Conversation
Thanks @hipstersmoothie, I'll take a look at this tomorrow hopefully and either merge or provide feedback then! |
Sorry, this is still on my to do list. It'll be done by the end of the weekend for certain. |
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.
Hi @hipstersmoothie, are you able to provide any test files for this?
If you don't have time, I can finish this off and get it released :)
removePlugin(), | ||
...postcssConfig.plugins.filter( | ||
// Postcss mixins plugin might be async and will break the postcss sync output. | ||
(plugin) => !['postcss-mixins'].includes(plugin.postcssPlugin), |
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.
Maybe it's better to just add a note to the docs here? As the plugin (from what I read) is only async when files are passed in.
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.
Yup! If we don't remove it for them we would have to pass something like env: editor
to accommodate. If the mixins aren't filtered and they are async, the plugin just doesn't work.
import { createMatchers } from './helpers/createMatchers'; | ||
import { isCSSFn } from './helpers/cssExtensions'; | ||
import { getDtsSnapshot } from './helpers/cssSnapshots'; | ||
import { Options } from './options'; | ||
|
||
import * as postcss from 'postcss'; |
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.
We load this in cssSnapshots.ts
. Was there a reason you decided to load a processor here as well?
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 decided to move the instantiation of the postcss processor here because it would:
- only be done once
- I needed access for to
info
to callinfo.project.getCurrentDirectory()
and didn't want to pass new params intocssSnapshots.ts
function create(info: ts.server.PluginCreateInfo) { | ||
const postcssConfig = getPostCssConfig(info.project.getCurrentDirectory()); |
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.
This tool looks great, but I see it's not official - so I should probably add that to the docs. What do you think?
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'm not sure that's true. You can see that they use this package in postcss-cli
here https://github.com/postcss/postcss-cli/blob/master/index.js#L14
Hi @hipstersmoothie, unfortunately I'm away until Sunday - it's been a crazy month. I'll get this out as a beta so that you can work and release a minor version when I get back - as I want to update a few things. |
OK, unfortunately the rebase on this requires a bit of work. I can take a look later today or tomorrow - sorry about the delay here. |
@mrmckeb took care of merging |
I've open postcss/postcss-mixins#96 to help with the mixins issue. I will be removing the lines that remove the plugin since this can break parsing if we remove it |
Thanks @hipstersmoothie, I've merged this and will release a new beta very soon. I'm travelling tomorrow and plan to use my airport time to polish this up and create a release. |
This is now in 1.3.1 (out of beta). Thanks again! |
My postcss config uses a plugin that adds some classnames for themes. This PR will load a postcss config if there is on and use it to transform the CSS