小编Dmi*_*hin的帖子

Next.js 生产版本不应用 css 变量

我有下一个 postcss 配置

module.exports = {
  plugins: [
    [
      'postcss-preset-env',
      {
        browsers: 'last 2 versions, IE 11, not dead',
        preserve: false,
        features: {
          'custom-media-queries': true,
          'custom-properties': true,
          'nesting-rules': true
        },
        importFrom: ['src/styles/variables.css']
      }
    ]
  ]
}

Run Code Online (Sandbox Code Playgroud)

这个文件带有 css 变量

@custom-media --desktop screen and (min-width: 768px);
@custom-media --mobile screen and (max-width: 767px);

:root {
  --montserrat: montserrat, sans-serif;
  --sfProDisplay: sf pro display, sans-serif;
  --helvetica: helvetica, sans-serif;
  --blue: #315efb;
  --middleBlue: #2c54e2;
  --darkBlue: #274bc8;
  --lightBlue: #e0ebff;
  --green: #21a038;
  --grey: #62687f;
  --darkGray: #343b4c;
  --blueGray: #8d96b2; …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs postcss next.js

5
推荐指数
1
解决办法
3142
查看次数

标签 统计

javascript ×1

next.js ×1

postcss ×1

reactjs ×1