rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

assetpack breaks app if "app/*" does not exist #165

Closed rolandjitsu closed 10 years ago

rolandjitsu commented 10 years ago

It seems like the gem runs the serve on some default paths (inside the options.rb file):

# Defaults!
serve '/css',    :from => 'app/css'     rescue Errno::ENOTDIR
serve '/js',     :from => 'app/js'      rescue Errno::ENOTDIR
serve '/images', :from => 'app/images'  rescue Errno::ENOTDIR

That forces me to add the folders even though I have a different folder structure. Therefore if I don't have the folders I get an error that the folders do not exist and the app will not start.

I think it should not force devs to follow the same conventions, since we, most often, have a different folder structure depending the project.

Is there any way to stop it from doing that ?

j15e commented 10 years ago

In ruby/rails world we often say "convention over configuration", this is why there is defaults (which I think are sane). If you don't like em, just configure yours.

That said, I think Sprocket does parse anything you put in /assets if you prefer. Sprocket is the assets manager ship with rails but is compatible with any rack-base application.

rolandjitsu commented 10 years ago

@j15e The issue is that if I don't have those folders in the app/ (js, css, images) folder, it won't start the app because it throws the error. Unless that is a bug, I really don't think it should set that for me, or at lease it should only do it if I don't provide new a configuration.

So that is what I am wondering, can I tell the extension not to set those defaults but to set whatever I told it in the

assets do
end

Otherwise it forces me to create those folders. And if we're talking convention, I often see folders like helpers, controllers, views, etc. in the app folder, not js, css or images.

rolandjitsu commented 10 years ago

@j15e It seems that now it's working, without the default folders created. I'm not sure what the issue was.