Fix sass-rails deprecation warning

3rd January 2015 – 109 words

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