1.0.5 • Published 7 years ago

url-extend-loader v1.0.5

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago
npm install --save-dev url-extend-loader

The url-extend-loader works like the file-loader, but can return a DataURL if the file is smaller than a byte limit.

import img from './image.png'

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: 'url-extend-loader'
            options: {
              limit: 8192,
              inlineFlag: '__inline'
            }  
          }
        ]
      }
    ]
  }
}

some.css

// config.limit: 8192
// arrow.png == 10000kb
background-image: url(/image/arrow.png);
// will be resolved by file-loader
background-image: url(/image/arrow.png?__inline);
// will be forced return a DataURL
NameTypeDefaultDescription
inlineFlag{String}__inlineForce inline files
limit{Number}undefinedByte limit to inline files as Data URL
mimetype{String}extnameSpecify MIME type for the file (Otherwise it's inferred from the file extension)
prefix{String}falseParameters for the file-loader are valid too. They are passed to the file-loader if used
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago