1.0.0 • Published 5 years ago

craco-resolve-url-loader v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Craco resolve-url-loader plugin

A plugin to fix the annoying way sass/scss doesn't support relative paths out of the box in your create-react-app v2 application. Without ejecting!

Installation

npm install --save craco-resolve-url-loader

update your craco.config.js as follows:

const resolveUrlLoader = require('craco-resolve-url-loader');

module.exports = {
  plugins:[{
    plugin:resolveUrlLoader
  }]
};

Now sass and scss files will resolve url's relative to the current file like so:

@font-face {
  font-family: 'myfont';
  src: url('../fonts/myfont.eot?v=0.1.0');
  font-weight: normal;
  font-style: normal;
}

License

Licensed under the MIT License, Copyright ©️ 2018 Michael Smit. See LICENSE.md for more information.