Closed kevinkurpe closed 10 years ago
Seems like your assets URL are relative when they should be absolute, this is you get 404 when your page is in a subfolder. You should trying setting your serve paths with a slash like this :
class Startups < Sinatra::Application
set :root, File.join(File.dirname(__FILE__), '../') # You must set app root,
register Sinatra::AssetPack
assets do
serve '/js', from: 'public' # Default
serve '/css', from: 'public' # Default
# css :application, 'assets/application.css', [
css :application, [
'/startups/stylesheets/foundation.css',
'/startups/stylesheets/normalize.css',
'/startups/stylesheets/responsive-nav.css',
'/startups/stylesheets/idangerous.swiper.css', #Homepage Slider
'/startups/stylesheets/override.css'
]
# js :application, 'assets/application.js', [
js :application, [
'/startups/javascripts/vendor/jquery.js',
'/startups/javascripts/foundation.min.js',
'/startups/javascripts/foundation/foundation.topbar.js',
'/startups/javascripts/foundation/foundation.abide.js',
'/startups/javascripts/idangerous.swiper-2.4.min.js',
'/startups/javascripts/responsive-nav.js',
'/startups/javascripts/vendor/modernizr.js'
]
js_compression :jsmin # :jsmin | :yui | :closure | :uglify
css_compression :sqwish # :simple | :sass | :yui | :sqwish
end
end
@j15e Thanks!
That fixed the issue I was experiencing!
I greatly appreciate it!
Certain routes in my sinatra app cause the sinatra assetpack gem to malfunction.
The gem plays nicely with this route:
The gem does not play nicely with this route:
The asset configuration:
I should mention that I have been using this gem for several months now without any issue.
I recently split the views directory of my app into three directories (views/admin, views/startups and views/other).
To accomplish this I added the following to my app:
Every other view renders correctly, with the exception of a very simpliar view.
Also, every view uses the same :layout, which in turn calls the same :header partial.
Thoughts? Why in the world does a route cause this gem to malfunction?