Skip to content
This repository has been archived by the owner on Dec 15, 2017. It is now read-only.

images processing #107

Closed
Hazantip opened this issue Jul 10, 2017 · 6 comments
Closed

images processing #107

Hazantip opened this issue Jul 10, 2017 · 6 comments

Comments

@Hazantip
Copy link

screen shot 2017-07-10 at 11 17 31

As you see, each image that i want to use i should require, but how to work with images with more comfortable way(without need to require each one)?

@micooz
Copy link
Owner

micooz commented Jul 10, 2017

With 30a21ab you can put your images to static/path/to/your/*.png, then access them directly from src without require:

<img src="/path/to/your/about.png" alt=""/>

@Hazantip
Copy link
Author

Thanks! 👍

@Hazantip
Copy link
Author

There is a one thing that doesn't work:

background: url('/assets/images/discretion.png') center center / cover no-repeat;
<img src="/assets/images/dunk.jpg" alt="">

this works good for development, but doesn't for build;
build requires to have source like:
<img src="assets/images/dunk.jpg" alt=""> - without '/' at the beginning

@micooz
Copy link
Owner

micooz commented Jul 11, 2017

How did you serve dist in production?

It should be worked if you serve them on a server not file:// I guess.


For example:

$ npm i -g http-server
$ http-server dist/

Then open http://localhost:8080.

@Hazantip
Copy link
Author

You're right. On a server it works fine, but locally(file://) isn't possible?

@micooz
Copy link
Owner

micooz commented Jul 12, 2017

Generally speaking, file:// is rarely used in practice. You should always running a server rather than double-click index.html.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants