olavea / gatsby-theme-picture-book

Create a Do-It-Yourself picture book together with a child you know.
https://petra-rabbit.netlify.com
7 stars 2 forks source link

Support changing the content paths by using theme options #27

Closed raae closed 5 years ago

raae commented 5 years ago

The users should be able to let the theme know that the images are not in content/images. It's in book/pages or something completely different if that is what they want.

Jason covers this concept in this egghead video: https://egghead.io/lessons/gatsby-configure-a-gatsby-theme-to-take-options

raae commented 5 years ago

Start by doing a replacement of content/images. Let's call the option imagePath.

  1. Change the name of the image folder in demo to pictures so the path becomes content/pictures.
  2. In the demo's gatsby-config.js add the option imagePath to the gatsby-theme-childrens-picture-book configurations.
  3. In the themes gatsby-config.js use the option imagePath instead of explicitly writing content/images on line 20.

If everything is one correctly you should still see the cover with "DEMO" as the page on path /.

Do this again for audio, add the option audioPath.

Why? So users of the theme are not constricted when it comes to the location of the files. It might collide with other themes using content etc.

olavea commented 5 years ago

😄 😸