admin管理员组文章数量:1420128
I want to add Stylelint to my Next.js app. I am asking if I can edit next.config.js
to add stylelint-webpack-plugin, so I get styles errors during pilation.
// next.config.js
module.exports = {
reactStrictMode: true,
};
I want to add Stylelint to my Next.js app. I am asking if I can edit next.config.js
to add stylelint-webpack-plugin, so I get styles errors during pilation.
// next.config.js
module.exports = {
reactStrictMode: true,
};
Share
Improve this question
edited Oct 15, 2022 at 7:30
Youssouf Oumar
asked Nov 30, 2021 at 3:56
Youssouf OumarYoussouf Oumar
46.6k16 gold badges103 silver badges105 bronze badges
1 Answer
Reset to default 5Prepare the setup for both CSS and SCSS
- Install needed packages:
npm i stylelint stylelint-webpack-plugin --save-dev
- Create a
.stylelintignore
file in your root folder et past in it:
node_modules
- Edit the
next.config.js
file:
const StylelintPlugin = require("stylelint-webpack-plugin"); // line to add
module.exports = {
reactStrictMode: true,
// lines to add
webpack: (config, options) => {
config.plugins.push(new StylelintPlugin());
return config;
},
};
Set up Stylelint with CSS
- Install the needed package:
npm i stylelint-config-standard --save-dev
- Create a
.stylelintrc
file in your root folder and past in it:
{
"extends": "stylelint-config-standard",
"rules": {
"string-quotes": "double"
}
}
Set up Stylelint with SCSS
- Install needed packages:
npm i sass stylelint-config-standard-scss --save-dev
- Create a
.stylelintrc
file in your root folder and past in it:
{
"extends": "stylelint-config-standard-scss",
"rules": {
"string-quotes": "double"
}
}
本文标签: javascriptHow to set up Stylelint in a Nextjs projectStack Overflow
版权声明:本文标题:javascript - How to set up Stylelint in a Next.js project? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745318367a2653258.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论