Skip to content
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

some fix #68

Closed
mibamur opened this issue Jun 27, 2016 · 1 comment
Closed

some fix #68

mibamur opened this issue Jun 27, 2016 · 1 comment

Comments

@mibamur
Copy link

mibamur commented Jun 27, 2016

# config/initializers/sassc_rails.rb
require "sprockets/engines"

module Extensions
  module Sprockets
    module Engines
      def register_engine(ext, klass)
        return if [
          Sass::Rails::SassTemplate,
          Sass::Rails::ScssTemplate
        ].include?(klass)
        super
      end
    end
  end
end

Sprockets::Base.send(:prepend, Extensions::Sprockets::Engines)

Rails.application.config.assets.configure do |env|
  env.register_engine '.sass', SassC::Rails::SassTemplate
  env.register_engine '.scss', SassC::Rails::ScssTemplate
end
# Gemfile
#...
gem 'sass-rails', require: false
gem 'sassc-rails', github: 'sass/sassc-rails'
#...
mibamur added a commit to mibamur/sassc-rails that referenced this issue Jun 27, 2016
depend on sass#6
but here - more clear sass#68
@ridem
Copy link

ridem commented Feb 7, 2017

With Sprockets 4 and gems using register_engine, this was the correct call for me:

# config/initializers/sassc_rails.rb
require "sprockets/engines"

module Extensions
  module Sprockets
    module Engines
      def register_engine(ext, klass, opts={})
        return if [
          Sass::Rails::SassTemplate,
          Sass::Rails::ScssTemplate
        ].include?(klass)
        super
      end
    end
  end
end
Sprockets::Base.send(:prepend, Extensions::Sprockets::Engines)

Rails.application.config.assets.configure do |env|
  if env.respond_to?(:register_transformer)
    env.register_transformer 'text/sass', 'text/css', SassC::Rails::SassTemplate.new
    env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new
  else
    env.register_engine '.sass', SassC::Rails::SassTemplate
    env.register_engine '.scss', SassC::Rails::ScssTemplate
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants