# CSS 中 URL 前空格修复

cssurl 前加空格,比如:

// before
format("woff2"),url(https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff?t=1640074908811)

// after
format("woff2"), url(https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff?t=1640074908811)

# 如何使用

安装

pnpm add @plugin-light/webpack-loader-css-url-blank-space -D

vue.config.js 中配置如下:

const { LOADER: cssUrlBlankSpace } = require('webpack-loader-css-url-blank-space')';

module.export = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.(css)$/,
          use: [cssUrlBlankSpace],
        },
      ],
    },
  }
}
Last Updated: 2024/10/12 08:54:40