Skip to content

Deprecated .css.scss extension #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions lib/sass/rails/importer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'active_support/deprecation/reporting'
require 'sass'
require 'sprockets/sass_importer'
require 'tilt'
Expand Down Expand Up @@ -93,6 +94,45 @@ def process_erb_engine(engine)
end
end

module Deprecated
def extensions
{
'css.scss' => :scss,
'css.sass' => :sass,
'css.scss.erb' => :scss_erb,
'css.sass.erb' => :sass_erb
}.merge(super)
end

def find_relative(*args)
deprecate_extra_css_extension(super)
end

def find(*args)
deprecate_extra_css_extension(super)
end

private
def deprecate_extra_css_extension(engine)
if engine && filename = engine.options[:filename]
if filename.end_with?('.css.scss')
msg = "Extra .css in SCSS file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss', '.scss')}."
elsif filename.end_with?('.css.sass')
msg = "Extra .css in SCSS file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass', '.sass')}."
elsif filename.end_with?('.css.scss.erb')
msg = "Extra .css in SCSS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss.erb', '.scss.erb')}."
elsif filename.end_with?('.css.sass.erb')
msg = "Extra .css in SASS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass.erb', '.sass.erb')}."
end

ActiveSupport::Deprecation.warn(msg) if msg
end

engine
end
end

include Deprecated
include ERB
include Globbing

Expand Down