-
-
Notifications
You must be signed in to change notification settings - Fork 75
Postcss-custom-media not working with Next.js #822
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
Comments
Hi @zhrivodkin, Do you have a minimal reproduction or a more detailed description of "not working"? As far as we know there is no interaction between |
Hi @romainmenke, thanks for answer, my minimal working setup (with css modules) is: /* package.json */
...
"next": "^13.1.5",
"react": "^18.2.0",
"@babel/preset-env": "^7.16.11",
"babel-loader": "^8.2.3",
"css-loader": "^6.6.0",
"postcss-loader": "^7.0.2",
"postcss-custom-media": "8.0.0",
... /* custom-media.css */
@custom-media --mobile (min-width: 428px);
@custom-media --tablet-s (min-width: 768px);
... /* postcss.config.js */
const path = require('path');
module.exports = {
plugins: [
...
['postcss-custom-media', {
importFrom: path.resolve(__dirname, 'src/assets/styles/custom-media.css')
}]
],
};
... /* timetable.module.css */
.timetable {
height: 51px;
margin-top: 3px;
@media (--tablet-s) {
height: 60px;
margin-top: 4px;
}
} Result: @media (min-width: 768px)
.styles_timetable__sxkq2 {
height: 60px;
margin-top: 4px;
} And when I update custom-media lib to version 9.1.1, remove |
Hi @zhrivodkin Thank you for this, Is it possible to put this together in something like stackblitz? This is important because the plugin does work for other stacks and setups. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@zhrivodkin We have created a new plugin that might resolve your issue : https://www.npmjs.com/package/@csstools/postcss-global-data Can you check this out and let us know if everything works as expected? |
@zhrivodkin All other issues that have been reported to us have been resolved with the addition of this new plugin. It would be awesome if we could know if this is also fixed or not. |
I am assuming this is fixed. |
Yes, problem resolved, thank you very much! |
Hello! It seems that
postcss-custom-media
not working withNext.js
if it being configured accordingly to their guidelines withoutimportFrom
prop, which one has been deprecated somewhere after 8.0.0 plugin version whenpostcss-preset-env
updated. Can you please give me an advise what to do? Leave working 8.0.0? Wait for updates?Thank you.
The text was updated successfully, but these errors were encountered: