-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Usage with Next.js framework #1
Comments
@raavanan did you try this https://www.npmjs.com/package/postcss-load-plugins#array ? |
@giuseppeg ,, tried that too,, still the same result. |
@giuseppeg, i went ahead and added the plugin within the package itself. Compilation runs through fine, but postcss transforms aren't getting applied in the output styles. I tried with the default postcss-color-function plugin too, no transformations are occurring. Before:
After:
|
@raavanan I haven't gotten the chance to try to add Can you paste your |
@giuseppeg, thanks for your humble response,, would be really helpful if you could share up an implementation sample with next.js, i am planning to migrate current site on this stack to cssnext based style approach. postcss.config.js
.babelrc
package.json - deps
|
@raavanan I tried to add the individual plugins (eg. postcss-custom-properties, postcss-color-function) and it works just fine. |
Reminds me this issue webpack-contrib/postcss-loader#138 |
@michael-ciniawsky got any idea why this is happening? Can it be an issue with postcss-load-plugins? |
@giuseppeg There was an issue with plugin packages like e.g postcss-cssnext were postcssrc(ctx, ctx.dir)
.then((plugins) => ...)
.catch((err) => console.error(err)) // No Config, Loading Plugin failed, Invalid Plugin found If this doesn't fix it, please file an issue @postcss-load-plugins asap 😛 |
@michael-ciniawsky awesome, that worked indeed. Thanks man! |
@michael-ciniawsky actually it doesn't work -.- See #2 |
@giuseppeg The issue seems not to be related to postcss. Error would be |
@michael-ciniawsky that is me throwing an error when the postcss processor fails https://github.com/giuseppeg/styled-jsx-postcss/blob/master/src/processor.js |
@giuseppeg Is there a way to get the original error message please ? ;) processor.js if (!plugins) {
plugins = await loader(options.env || process.env)
} Why setting [only] the ENV here ? :) Node API // ctx -> {Obejct} -> ctx || {}
// path -> {String} -> path || process.cwd()
postcssrc(ctx, path)
.then(({ plugins , file }) => console.log(plugins, file) )
.catch((err) => console.error(err)) processor.js import { dirname } from 'path'
import postcss from 'postcss'
import postcssrc from 'postcss-load-plugins'
...
if (!plugins) {
/**
* 1. options === ctx => (ctx) => { plugins: { 'postcss-plugin': ctx.plugin }}
* 2. path === dirname(src)
* => start searching (upwards) for postcss.config.js in current file directory
* => multiple configs possible (global/local)
*/
plugins = await loader(options, dirname(src))
} |
@michael-ciniawsky here is the full stack trace https://gist.github.com/giuseppeg/24df3782e69856dd066fd504d71962fe
That's in case someone wants to override it but probably it is not necessary.
|
@giuseppeg, does individual plugins have to be within the module itself or will it get picked if i have the plugin configuration at root of next.js app. For some reason, the transformations don't happen with postcss-nested plugin installed at the next app root. Would be helpful if u could share an implementation example. Thanks for your wonderful contribution 👏 |
@giuseppeg Everytime process.env.NODE_ENV is changed e.g
|
@giuseppeg Thats the error stack trace from travis, but that doesn't help, it's babel erroring there, even in all the module paths there is no |
@michael-ciniawsky that stack trace has more info.
I'll ping you on gitter |
Yep, I not sure where but its seems to be a problem when babel is traversing the JSX AST |
@giuseppeg: My bad,, works fine with the latest release. Thank You! P.S. |
@raavanan released |
Fixed via vercel/next.js/pull/781 |
Works very well ! Thanks @giuseppeg |
@giuseppeg , in continuation to the conversation at vercel/styled-jsx#5, I upgraded to the latest release 0.14, it fixed the previous issue. Now i seem to get a new error related to postcss plugins i suppose. Below is the error occurred.
I have installed "postcss-cssnext": "^2.9.0" plugin and have configured postcss.config.js as below referring to the docs at postcss-load-plugins. Please let me know if there is an issue with the way i am configuring the postcss plugins.
The text was updated successfully, but these errors were encountered: