Css-loader: Ignore `url` and `@import`

Created on 14 Jul 2015  路  6Comments  路  Source: webpack-contrib/css-loader

Provide a mechanism to ignore url and @import.

From GItter

arb can i use the CSS loader and make it ignore any @import or url()?
sokra 12:59
nope... but feel free to send a PR: css-loader?-url&-import

Most helpful comment

Also looking for a way to disable a siingle url() call. Currently CSS-Loader is kind of an all-or-nothing approach if I am correct? This makes it hard to upgrade legacy apps.

Edit: Just realized path that start with a / are excluded /images/test. However, I've been using ../images/ in all apps which does gets parsed.

All 6 comments

+1 useful options

A note of interest is that the older versions (eg: 0.14.5) DID have that feature: css?url=false

I could use this feature as well.

+1.

For example:

@font-face {
  font-family: 'WhiteAdobeAndroid';
  src: url('file:///android_asset/fonts/AGaramondPro-Regular.otf') format('truetype'); 
}

I used a file url file:///android_asset, which only exists under Android platform. But css-loader would require ./file:///android_asset folder. I have no idea how to compile it to a normal text instead of using require.

But I didn't mean that I need an option for switching require or not require all urls. Instead, I need a way that I could tell the css-loader which path I don't want to be loaded.

Is there any way to disable the require behavior of a single place url() instead of disabling all files'?

Also looking for a way to disable a siingle url() call. Currently CSS-Loader is kind of an all-or-nothing approach if I am correct? This makes it hard to upgrade legacy apps.

Edit: Just realized path that start with a / are excluded /images/test. However, I've been using ../images/ in all apps which does gets parsed.

Was this page helpful?
0 / 5 - 0 ratings