30

In the ember-cli folder structure where should I put images?

/app
/bower_components
/config
/dist
/node_modules
/public
/tests
/vendor

I am using ember-cli version 1.13.1.

Undefined
  • 11,234
  • 5
  • 37
  • 62

1 Answers1

64

Create a folder inside public -> public/assets/images/, and place your images inside. You can then access them in the browser using /assets/images/imagename.png

Source from the ember-cli documentation it states:

Raw Assets

public/assets vs app/styles To add images, fonts, or other assets, place them in the public/assets directory. For example, if you place logo.png in public/assets/images, you can reference it in templates with assets/images/logo.png or in stylesheets with url('/assets/images/logo.png').

ndequeker
  • 7,932
  • 7
  • 61
  • 93
Undefined
  • 11,234
  • 5
  • 37
  • 62
  • 1
    hey you are absolutely right. but i have a question how to add any java scripts file to my projects. – Nitesh singh Feb 17 '16 at 17:17
  • @niteshsingh you can add it in vendor folder and give the path in ember-cli-buid.js file as follows app.import('vendor/jquery-browser-mobile/jquery.browser.mobile.js'); – iOS dev Sep 08 '16 at 17:34
  • To reference, I think you need `/images/{{model.story.id}}.png` and no more `/assets` these days. Just fought with this for 30 min. – sheriffderek Oct 02 '16 at 19:27
  • 2
    For anyone trying to figure out why their images aren't loading on prod, make sure that you're considering the fingerprinting that ember puts on files such as images by default. https://ember-cli.com/asset-compilation – Alex Podworny Mar 23 '17 at 21:46