-
Notifications
You must be signed in to change notification settings - Fork 93
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
Don't set the "from" option when reading from stdin. #122
Comments
if I remember right, the dummy |
OK. Then why not: options.from = file === 'stdin' ? process.cwd() : file; |
I asked the same 😛 => #114 Seems |
So as I see it, my options are:
I don't want to do any of these and would prefer the removal of the fake file; there has to be a better solution. If that's not changed I guess I will be sticking with option 1 as it is the least bad one. |
See #115 (comment)
It seems it does. @ai Thoughts here? |
In General 👍, it's a 'bug' in browerslist 😛
Disagreeing here 😛 A 'classical/traditional' CLI has to support
Is it 'confirmed' that
? 😉 , but I see the use of |
I am using cosmiconfig to find a config file relative to the input, the problem is that it performs a stat call on the file path (
I can resolve this by removing the cosmiconfig call, so I figure it's the source of the error. Ideally I want to deprecate cssnano wrappers so that I have less to maintain, am happy if people want to take up that workload but I won't be doing so. Possibly should create a separate issue for this. And cssnano v4 ships with presets, it's different to |
Maybe we need to fix cosmiconfig to not throw on unknown file? |
I guess cosmiconfig needs to stat the file path to check if it's a directory or not. https://github.com/davidtheclark/cosmiconfig/blob/de81cf6f4bd8f18f4c36255b8a9f13733e3cc7f7/lib/createExplorer.js#L100 |
? 🙃 Use a
Yep, but by design choice then 😛 and why ? Will it be incompatible to postcss.config.js module.exports = () => ({
plugins: {
cssnano: { preset: 'name', [presetOptions: {...}] } // ?
}) |
Like I said, it's a dirty hack. I should expect that the file coming from No, you can pass the preset directly as an option to cssnano, so it's not incompatible. 😄 |
By the way it would probably be better to use a file abstraction rather than making up paths on disk, such as https://github.com/vfile/vfile or https://github.com/gulpjs/vinyl. |
The responsibility to handle this impure behaviour was basically shifted form |
No extra deps 💪 😛 to handle architectural issues, if solvable otherwise I suggested to use |
¯_(ツ)_/¯ |
For me this is resolved with the latest cosmiconfig, so I don't think we need a resolution here for now. 😄 |
The
from
option indicates the path of the file being read from; in the case of stdin, it's a special case that I think we have to handle differently.With the current behaviour, because I am using cosmiconfig to find configuration presets, an error is thrown because https://github.com/postcss/postcss-cli/blob/master/index.js#L287 (
/path/to/project/stdin
) is not a valid file. I suggest that we change this behaviour to set this option only whenfile
does not equalstdin
; e.g:Replacing the problematic line with this above code resolves the issue for me.
The text was updated successfully, but these errors were encountered: