-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
feat: add support for TypeScript based configs #632
Changes from 6 commits
dd2166b
ae7cf85
d221925
918e4de
91216f4
9d4b5a3
f21a091
0902bb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.import { | ||
color: goldenrod; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import 'imports/section.css'; | ||
|
||
.test { | ||
color: cyan; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import style from './index.css' | ||
|
||
export default style |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Config as PostCSSConfig } from 'postcss-load-config'; | ||
import { Configuration as WebpackConfig } from 'webpack'; | ||
|
||
module.exports = function (api: WebpackConfig): PostCSSConfig { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, it should be https://github.com/webpack-contrib/postcss-loader/blob/master/src/utils.js#L152, it is mix of types, so I think we just need to add this to documents There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to update types in docs and we can merge + small example, thank you |
||
return { | ||
parser: 'sugarss', | ||
syntax: 'sugarss', | ||
map: api.mode === 'development' ? 'inline' : false, | ||
from: './test/fixtures/config-autoload/js/object/index.css', | ||
to: './test/fixtures/config-autoload/js/object/expect/index.css', | ||
plugins: [ | ||
'postcss-import', | ||
[ | ||
'postcss-nested', | ||
{ | ||
// Options | ||
} | ||
], | ||
require('postcss-nested'), | ||
require('postcss-nested')({ /* Options */ }), | ||
] | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.import { | ||
color: red; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "imports/section.css"; | ||
|
||
.test { | ||
color: blue; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import style from './index.css' | ||
|
||
export default style |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Config as PostCSSConfig } from 'postcss-load-config'; | ||
import { Configuration as WebpackConfig } from 'webpack'; | ||
|
||
const config = function (api: WebpackConfig): PostCSSConfig { | ||
return { | ||
parser: 'sugarss', | ||
syntax: 'sugarss', | ||
map: api.mode === 'development' ? 'inline' : false, | ||
from: './test/fixtures/config-autoload/js/object/index.css', | ||
to: './test/fixtures/config-autoload/js/object/expect/index.css', | ||
plugins: { | ||
'postcss-import': {}, | ||
'postcss-nested': {}, | ||
} | ||
} | ||
}; | ||
|
||
export default config; |
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.
@alexander-akait I believe this is the way to solve the issue.