0.0.1 • Published 8 years ago

css-exact-url-loader v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

css-exact-url-loader NPM version Dependency Status

Webpack plugin to transform URLs to exact URLs on CSS.

Description

Transform url() on your CSS.

Install

yarn add --dev css-exact-url-loader

Usage

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

OptionDescriptionMust?
frompath in url()Y
totransformed pathY
envexecute when only 'production'N
0.0.1

8 years ago

0.0.0

8 years ago