postcss / postcss-url

PostCSS plugin to rebase url(), inline or copy asset.
MIT License
377 stars 59 forks source link

Compatible with postcss-loader and Webpack 4? #125

Closed DevanB closed 6 years ago

DevanB commented 6 years ago

This looks absolutely fantastic, but I'm trying to get it working with postcss-loader and webpack 4. I've tried the following, but think it 1) doesn't work with Webpack 4 or 2) isn't configured correctly.

Thanks for any help!

const options = {
  url: "copy",
  basePath: path.resolve(__dirname, "..", "node_modules", "rgbwpack", "dist", "media"),
  assetsPath: "img"
}
{
  test: /\.css$/,
  use: [
    MiniCSSExtractPlugin.loader,
    "css-loader",
    {
      loader: "postcss-loader",
      options: {
        plugins: () => [url(options)]
      }
    }
  ]
}