-
-
Notifications
You must be signed in to change notification settings - Fork 161
Support for extra postcss plugins #100
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
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.
Looks good. Thank you.
Made just a few small change requests.
Please also add a note to the commit saying that it is a "BREAKING CHANGE:" to trigger the major version bump.
src/requireCssModule.js
Outdated
const getTokens = (runner, cssSourceFilePath: string, filetypes): StyleModuleMapType => { | ||
type FileTypeOptions = {| | ||
syntax: string, | ||
plugins: Array<string> |
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.
Please use $ReadOnlyArray
and covariant props, i.e. {|+syntax: string, plugins: $ReadOnlyArray<string>|}
src/requireCssModule.js
Outdated
plugins: Array<string> | ||
|}; | ||
|
||
const getFiletypeOptions = (cssSourceFilePath: string, filetypes: Object): ?(string|FileTypeOptions) => { |
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.
filetypes
type needs to be {[key: string]: FileTypeOptions}
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.
?(string|FileTypeOptions)
does not match the return type (not getting an error here?) FileTypeOptions | string | null
.
Where does the string
come from, though?
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.
Where does the string come from, though?
I see.
Lets remove the shortcut. This is going to be a breaking change.
Require that FileTypeOptions
is always present.
src/requireCssModule.js
Outdated
return filetype; | ||
}; | ||
|
||
const getSyntax = (filetypeOptions: ?(string|FileTypeOptions)) => { |
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.
Require that filetypeOptions
is always FileTypeOptions
. Do not call getSyntax
if filetypeOptions
option is void.
src/requireCssModule.js
Outdated
return null; | ||
}; | ||
|
||
const getExtraPlugins = (filetypeOptions: ?(string|FileTypeOptions)): Array<any> => { |
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.
Use $ReadOnlyArray
src/requireCssModule.js
Outdated
return filetype; | ||
}; | ||
|
||
const getSyntax = (filetypeOptions: ?(string|FileTypeOptions)) => { |
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.
Declare the return type annotation for getSyntax
.
@@ -5,7 +5,9 @@ | |||
{ | |||
"generateScopedName": "[name]__[local]", | |||
"filetypes": { | |||
".less": "postcss-less" | |||
".less": { | |||
"syntax": "postcss-less" |
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 is using the old syntax.
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've changed it to Object { "syntax": "..." }
. Sorry, what's wrong?
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.
Oops. Sorry. This PR was the first thing I looked at this morning. :-)
So. What's next? I've updated the code according to your requests. |
Sorry, overloaded at work. Merged. Thank you, |
Is there any way to set options on the plugins loaded this way? |
Added support for extra postcss plugins. They can be specified in
"filetypes"
section of config like this: