Fix sass-rails deprecation warning

on under developer
1 minute read

Out Of Date Warning

This article was published on 03/01/2015, this means the content may be out of date or no longer relevant.
You should verify that the technical information in this article is still up to date before relying upon it for your own purposes.

After upgrading Sass-Rails and Rails to the newest version, I've got a bunch of deprecations:

DEPRECATION WARNING: Extra .css in SASS/ERB file is unnecessary. Rename app/assets/stylesheets/_components.css
.sass.erb to app/assets/stylesheets/_components.sass.erb. (called from
_app_views_layouts_application_html_slim___81449009409066381_98316040 at app/views/layouts/application.html.slim:10
...

Turns out, Sass-Rails from version 5.0.1 doesn't want the Rails-Way of naming CSS-files anymore (Github Issue)

Using some Unix-MagicĀ® with find and rename:

find app/assets/stylesheets -name '*.css.s[ca]ss*' | rename -v -n 's/.css.s([ac])ss/.s$1ss/'

Drop the -n to really rename the files.

Git will automatically track the renaming:

git add -u app/assets/stylesheets
git add app/assets/stylesheets