0
Follow
0
View

Why won't my css stylesheet work in Sinatra?

db3138ice 注册会员
2023-01-24 20:47

With a server.rb like

require 'sinatra'

set :public_folder, __dir__ + '/static'

get '/' do
  erb :index
end

A views/index.erb like

css" href="/css/stylesheet.css">

Hi!

And your stylesheet in static/css/stylesheet.css it should work, the important bit you may be missing is setting the public folder.

About the Author

Question Info

Publish Time
2023-01-24 20:47
Update Time
2023-01-24 20:47