GITHUB: https://github.com/coasterb/foo_bar_stackoverflow
I cannot access the style sheet in my public directory with my '/foo/bar' route.
I thought it was an issue where I didn't define the public_folder
, but it isn't.
require 'sinatra'
require 'haml'
set :static, true
set :public_folder, "public"
get '/foo' do
haml :foo
end
get '/foo/bar' do
haml :bar
end
# Directory hierarchy - this doesnt work
+Webapp
--app.rb
-+public
---stylesheet.css
-+views
---foo.haml
---bar.haml
# Directory hierarchy - This does work but i now have a copy of my files.
+Webapp
--app.rb
-+public
---stylesheet.css
--+foo
----stylesheet.css
-+views
---foo.haml
---bar.haml
localhost:9396/foo/bar:
#foo/bar.html from the web browser.
<html>
<head>
<link href='./stylesheet.css' rel='stylesheet' type='text/css'>
</head>
<html>
throws an error in Chrome's console, of "404 not found", but does not throw an error in /foo console.
haml bar.haml:
!!!
%html
%head
%link{:href=>"./stylesheet.css", :rel => "stylesheet", :type => "text/css"}