Feat/add regexp support for filetype #240
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add supports for using RegExp patterns as key names in
filetype
Usage
Now, we can use a RegExp pattern in
filetypes
to specify a certain file.Consider the following config.
According to the config above,
babel-plugin-react-css-modules
will match and processanother.mod.sass
, but liveanother.sass
alone.Why is this useful?
Sometimes, I want to import some
.sass
file as global styles (such as styles for the common UI). However, if I just add the key.sass
tofiletypes
, then all imported.sass
files would be processed, including those containing global styles. (By the way, I dislike:global
.)The support for RegExp patterns would also be useful when assigning the different plugin lists (or other config items) to the different
.sass
files.Compatibility
The all test cases is covered. (
yarn test
on my computer.)It is worth discussing further if there are any better implements or API designs.