Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using images with slingshot example #106

Closed
brianshrader7 opened this issue Apr 12, 2016 · 3 comments
Closed

Using images with slingshot example #106

brianshrader7 opened this issue Apr 12, 2016 · 3 comments

Comments

@brianshrader7
Copy link

I'm not sure if this is the right place to post this question, but how do I get the slingshot example to work with images?

I figured out how to build the dev version with images by adding the following line to the getLoaders function in webpack.config.js:

{ test: /\.(jpe?g|png|gif|svg)$/i, loaders: ['url?limit=8192', 'img']}

But I can't figure out how to add the images to the build when you run npm run build. I know that I need to add && mkdir images to the create-dist command, but I haven't been able to figure out the remaining steps. Any advice would be greatly appreciated.

@coryhouse
Copy link
Owner

A commit I made yesterday split the webpack.config into separate dev and prod versions for readability. Whatever loader you add for dev you'll need to add to the prod config as well.

@brianshrader7
Copy link
Author

Thanks for the reply!

Just remembered that I was building off of the Tour of Heroes repo, so I didn't have the latest changes. I took a look at your commit and did a pull, and I see images working on dev out of the box.

However, I still don't know how to get the images included in the prod build. Is there an extra step I need to add for that? Really all I would need is to copy my /images folder from /src to /dist but I'm new to Webpack so I haven't been able to figure that out quite yet.

@coryhouse
Copy link
Owner

Required images should work in the prod build with Slingshot. It's configured in the prod webpack config.

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

No branches or pull requests

2 participants