rails / sprockets-rails

Sprockets Rails integration
MIT License
579 stars 246 forks source link

Strangeness with added asset path writing to subdir during compilation #262

Open stewbawka opened 9 years ago

stewbawka commented 9 years ago

I really can't get my head around this. I have some static haml templates that i'm serving up through the asset pipeline. i have added this to my config/application.rb:

config.assets.paths << "#{Rails.root}/app/assets/templates/accounts"

This has worked beautifully for me for the past year and normally all of the assets in that folder normally get compiled into public/assets. For a recent feature I have just completed i added 2 new html.haml files into that directory 'accountsNav.html.haml' and 'accountsSocialMedia.html.haml'.. 'accountsSocialMedia.html.haml' is going into public/assets as expected, but the other one is actually going into public/assets/accounts/accountsNav.html.haml! Looking at my public/assets there is only one other subdirectory and that is for bootstrap font stuff that is vendored.

When creating the manifest for assets what could be happening that would cause it to prepend an 'accounts' subdir to the logical path?

stewbawka commented 9 years ago

FYI this is happening for sprockets-rails 2.3.2, but was also happening with 2.3.1 (I upgraded just in case)

stewbawka commented 9 years ago

I've tracked down what is causing it... In my application.rb I have some js.coffee.erb files that are listed with config.assets.precompile. In those there is some references to my html.haml templates with asset_path. All of those referenced assets end up just going into assets when precompiled, the html.haml i added wasn't being referenced in any of those files, but rather in a non-asset server side haml template.