A
A
aiband2016-10-24 22:33:13
JavaScript
aiband, 2016-10-24 22:33:13

How not to import a file in webpack?

Hello.
The question is formulated rather silly, I understand. I will describe in more detail. I have a .less file that includes fonts. Webpack (according to what I googled) can either insert base64 instead of this import, or copy the fonts to the build folder and import them from there. I'm wondering if it's possible to just leave the path to the fonts as it is? Don't import anything. The fonts are in their own folder.

@font-face {
 font-family: 'Ubuntu Regular';
 src: url('../fonts/Ubuntu-R.ttf');
}

So that I get the same output. Same src: url('../fonts/Ubuntu-R.ttf');
I could only block imports from less files altogether. But now there is a need to import the styles of a third-party library into the main .less.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nazar Mokrinsky, 2016-10-25
@nazarpc

What for?
The point is that relative paths will break when moving the CSS to another folder, so it's safer to put the files side by side. In order to correct the paths, you need to know the server configuration. My framework can do this - it just corrects the relative paths to similar files. Webpack doesn't seem to have enough information for this, or it just hasn't been implemented yet.

S
Serge K, 2016-10-25
@korotkin

https://www.npmjs.com/package/url-loader

Q
qtuz, 2016-10-29
@qtuz

Out of the box there is IgnorePlugin .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question