-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How To: Run dashing on a sub path
Dashing runs on root by default. With some small changes we can make it run on a sub path. Be aware that not all of the following changes are required if you are running behind a gateway that will strip part of your path. In such a case html assets will need the sub-path and so will default_dashboard
if you choose to set one.
In the top of your application.coffee
, add the view prefix Dashing should use:
Batman.config.viewPrefix = '<sub path>/views'
Your template in layout.erb
must also be aware of the new path. Add the sub path in the following places.
<script type="text/javascript" src="/<sub path>/assets/application.js"></script>
<link rel="stylesheet" href="/<sub path>/assets/application.css">
<link rel="icon" href="/<sub path>/assets/favicon.ico">
In config.ru
you add the sub path as your new assets prefix.
...
set :assets_prefix, '/<sub path>/assets'
map Sinatra::Application.assets_prefix do
run Sinatra::Application.sprockets
end
...
Also in config.ru
, instead of run Sinatra::Application
to start the application you can use Rack:URLMap
run Rack::URLMap.new('/<sub path>' => Sinatra::Application)
The app will now be running on http://localhost:3030/<sub path>/<dashboard>
When setting a default dashboard, remember to include the sub path.
set :default_dashboard, '<sub path>/<dashboard>'