Question

  • i generated the scaffold of a famo.us project with Yeoman (yo famous)
  • i set up i small working project
  • i tried to launch it with 'grunt serve' command

it all works but no image is loaded because the folder content/images is not loaded

how can i include it? thanks

Was it helpful?

Solution

I'm Myles the author of the Famous-Generator. The images in '/content/images/' should be able to be loaded as an absolute or relative path... although I have just updated the generated 'main.js' to use an absolute path for the sake of being explicit.

Remember that when you famous code is run it will be running inside of index.html, and therefore have the same "relative path" for included assets. As well, since you are serving via a development server, you are able to reference anything with absolute paths relative to the root directory of the project.

You should not have to touch requireConfig at all to be honest. It is only used to add vendor code installed in 'lib' to your path within require so you can reference modules by name rather than path. 'underscore' rather than '../lib/underscore'. This becomes nice as you begin to nest folders and don't want to have to manage relative paths. This also makes your code a lot more portable!

A nice sidebar, you should install all vendor code with 'bower install --save $LIB_NAME'. This will save the library / version to your bower.json and inject the path for the module into you requireConfig. Basically you can bower install anything and just start requiring!

OTHER TIPS

yo famous is working just fine!

it was my mistake to try to set relative paths inside requireConfig including images: that is not working but i don't know if it is supposed to!

you have to use relative paths for every image and everything will be ok!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top