0.0.1 • Published 8 years ago
css-exact-url-loader v0.0.1
css-exact-url-loader 
 
Webpack plugin to transform URLs to exact URLs on CSS.
Description
Transform url() on your CSS.
Install
yarn add --dev css-exact-url-loaderUsage
A example of webpack.config.js is below.
module.exports = {
  ...
  module: {
    rules: [
      ...
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            'css-loader',
            {
              loader: 'css-exact-url-loader',
              query: {
                from: '/assets/',
                to: 'https://domain/assets/'
              }
            }
          ],
        }),
      },
      ...
    ],
  },
  plugins: [
    ...
    new ExtractTextPlugin('bundle.css'),
    ...
  ],Other example of webpack.config.js is below.
module.exports = {
  ...
  module: {
    rules: [
      ...
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            'css-loader',
            {
              loader: 'css-exact-url-loader',
              query: {
                from: '/assets/',
                to: '/dir/assets/'
              }
            }
          ],
        }),
      },
      ...
    ],
  },
  plugins: [
    ...
    new ExtractTextPlugin('bundle.css'),
    ...
  ],Options
| Option | Description | Must? | 
|---|---|---|
| from | path in url() | Y | 
| to | transformed path | Y | 
| env | execute when only 'production' | N |