Y
Y
Yaroslav Lyzlov2015-10-30 10:46:57
JavaScript
Yaroslav Lyzlov, 2015-10-30 10:46:57

webpack. Url-loader returns a misspelled url, what's the problem?

Good afternoon. In general, such trouble, url-loader returns a base64 curve.

require('url?limit=10000!./resources/images/obladaet.jpg');

webpack conf
{ test: /\.jpg$/,    loader: "url-loader?prefix=img/" },

And another question: how to use url-loader with stylus?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Dubrovsky, 2015-10-30
@dixoNich

Hello. I just use stylus. I have this in my config:

{ test: /\.(png|jpg|gif)$/, loader: 'url-loader?limit=8192' }
{ test: /\.styl$/, loader: "style-loader!css-loader!stylus-loader?paths[]=node_modules&paths[]=app" }

I connect pictures through styles, webpack itself puts them in the assembly.
.vusluk-logo
  background-image url(./logo.png)

F
frontendthug, 2015-12-25
@frontendthug

test: /\.jpg$/,    loader: "url-loader?name=img/[name].[ext]"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question