feat: support usage of globs in cli mode#434
feat: support usage of globs in cli mode#434thepassle wants to merge 3 commits intoparcel-bundler:masterfrom
Conversation
| match glob(g) { | ||
| Ok(file_paths) => { | ||
| for file in file_paths { | ||
| if let Ok(f) = file { |
There was a problem hiding this comment.
I was also wondering if you could give me some pointers on this code, there's quite a bit of nested pattern matching going on, is there a cleaner/more idiomatic way to approach this? Or is this considered fine?
There was a problem hiding this comment.
One question I have is if we need to expand globs ourselves here or not? Usually the shell (e.g. bash) will expand globs before executing the program, so the glob itself will never reach it, it'll just be a list of files.
There was a problem hiding this comment.
During development I used the following command to run the cli:
⚡ cargo run --features="cli" "*.css"
Finished dev [unoptimized + debuginfo] target(s) in 0.58s
Running `target/debug/lightningcss '*.css'`
html {
color: red;
}
body {
background: green;
}
Having the quotes around the glob does seem needed, if you provide the glob without quotes, it does indeed get expanded by the shell, and result in the following:
⚡ cargo run --features="cli" *.css
Finished dev [unoptimized + debuginfo] target(s) in 0.42s
Running `target/debug/lightningcss test.css test2.css`
error: Found argument 'test2.css' which wasn't expected, or isn't valid in this context
USAGE:
lightningcss [OPTIONS] [INPUT_FILE]
For more information try --help
aee3767 to
a4c2d82
Compare
a4c2d82 to
531d722
Compare
|
Hey sorry it took so long for me to get back to you on this. I think we will need to change a few things. At the moment, this will take only glob literal, which you need to quote to prevent your shell from expanding them. It would be nice if you could do In addition, at the moment this will compile each file, but then output them all concatenated together to stdout. If you use the |
EDIT: I seemed to have fixed the issue 🙂 The PR can be reviewed now
🎉
this PR isnt quite finished, it seems to be almost working, but I'm running into one issue that I cant quite figure out, I was hoping you could give me some pointers on that one, @devongovett ?The issue is the following:fixes #90