Linking to CSS in the Sinatra project layout

I’ve been working on a ruby project recently, and I’ve come to do a Web GUI for it. I’m using Sinatra and following the template laid out in learnrubythehardway. I was wanting to make it a bit more pretty though. I’ve linked bootstrap 4 in the layout.erb, but I was also wanting to put in some of my own CSS. I was trying to link to an index.css that I’d put in the static folder, but I couldn’t seem to get it to work (I tried “…/static/index.css”, “/index.css” and “index.css”). In the end I’ve just stuck it inside at the top of layout.erb. Is it fine just sticking all my shared CSS here? If not, how would I need to link back to it in the static folder, or elsewhere if it doesn’t make sense it being there?

You want to hit the configuration docs here:

http://www.sinatrarb.com/configuration.html

Then look at the options for :static, and :public_folder, to enable static files and then set where they live. They recommend you do something like this:

set :public_folder, Proc.new { File.join(root, "static") }

So that the static folder has a full path, but is based on your root setting.