rails / sass-rails

Ruby on Rails stylesheet engine for Sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow overriding files with a relative @import

azul opened this issue · comments

commented

I have a simple app/assets/stylesheets/application.scss:

@import 'head'
...

head.scss contains the defaults but is meant to be overwritten from a customizable directory that is preceedign app/assets/stylesheets in the asset load path.
But since head.scss is found in the path relative to application.scss the head.scss will never be used.

I can work around this by either putting the application.scss in the customization path or moving everything into a subdir so i can use paths that can only be read as absolute paths.

Both workarounds are counterintuitive and should not be needed. If i @import sub/relative from within /foo/parent.scss I would expect sass-rails to look for 'foo/sub/relative' inside the load_paths according to their priority and if no such file is found to look for 'sub/relative'.

This way one could overwrite any file by putting another file in the same location in a load path with higher priority.

commented

@rafaelfranca was cited on http://github.com/spree/spree/issues/3415#issuecomment-32821148

I think the proper fix is to put the current path to the end of the search.

I'm proposing something else here because i think defaulting to relative paths is sass's way of handling the import ambiguity and we should not break that.