Comments (17)
register_engine
has been deprecated in Sprockets 3, so I had to use the following initializer to work with Rails 5 and Sprockets 4:
Rails.application.config.assets.configure do |env|
env.register_mime_type 'text/css', extensions: ['.scss'], charset: :css
env.register_mime_type 'text/css', extensions: ['.css.scss'], charset: :css
env.register_preprocessor 'text/css', SassC::Rails::ScssTemplate
end
from sassc-rails.
I have a cleaner workaround to propose:
# Gemfile
gem 'sass-rails', require: false
gem 'sassc-rails'
This ensures that sass-rails
is not automatically require
'd, making sassc-rails
take over. This of course won't work if a gem explicitly requires sass-rails.
from sassc-rails.
Hi! Has a permanent fix for this issue been made? I really want to use SassC in my project!
from sassc-rails.
@constantm I've released version 0.0.6
, which I believe addressed this problem. If you have both installed, sassc-rails should override sass-rails. Please give it a shot and let me know how it goes!
from sassc-rails.
updated to this:
# 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.assets.register_engine '.sass', SassC::Rails::SassTemplate
# Rails.application.assets.register_engine '.scss', SassC::Rails::ScssTemplate
Rails.application.config.assets.configure do |env|
env.register_engine '.sass', SassC::Rails::SassTemplate
env.register_engine '.scss', SassC::Rails::ScssTemplate
end
from sassc-rails.
Hey! This gem is very much a work in progress. Your mileage may vary.
It seems that your project isn't using sassc-rails
to compile. Could you try some of the following:
- remove sass-rails
- after bundling, double check that sass-rails is not present
- remove cache assets folder
- spring stop? restart server?
from sassc-rails.
Had a quick look and it seems that sass-rails is still getting included because of ActiveAdmin's dependency on it. I forked ActiveAdmin and replaced the dependencies on sass-rails
with sassc
and it works perfectly now. Obviously that's not the best way to go about doing things - is there some way that you're aware of to do this in a more sustainable way?
from sassc-rails.
I had to revert the changes here, i'm trying this out:
in an initializer: config/initializers/sassc_rails.rb
Rails.application.assets.register_engine '.sass', SassC::Rails::SassTemplate
Rails.application.assets.register_engine '.scss', SassC::Rails::ScssTemplate
from sassc-rails.
I ran into some more issues with this. I had to add the following to the initializer in the previous comment:
# 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.assets.register_engine '.sass', SassC::Rails::SassTemplate
Rails.application.assets.register_engine '.scss', SassC::Rails::ScssTemplate
from sassc-rails.
i'd welcome anyone else's thoughts on a more permanent solution - do we simply include the about in the sassc-rails railtie?
from sassc-rails.
@bolandrm here you go :)
from sassc-rails.
Testing against my rails project, this issue does not seem to be resolved yet.
from sassc-rails.
I can help to investigate. In my project the problem was that a sass rails initializer was setting up sprocket engines.
In your case were sprocket engines pointing to sass instead of sassc? If so, than can you check separately whether sass-rails initializer was ran or not.
If not then you need to track where they're registered from (like you did with your monkeypatch of register_engine) .
If yes, then tell me what rails version do you use? And then I'll check whether a different railtie loading mechanism is used there compared to latest rails.
from sassc-rails.
The workaround doesn't help for me, btw. I've placed it in config/initializers
, register_engine
never gets called for Sass::Rails
.
from sassc-rails.
@bolandrm last comment
and
gem 'sass-rails', require: false
gem 'sassc-rails', github: 'sass/sassc-rails'
worked fine
from sassc-rails.
config/initializers/sassc_rails.rb
does not work for me. It has conflicts with slim-rails
. Since in my project the only gem that requires sass-rails
is activeadmin
, I updated the dependency of activeadmin
and it works really well: activeadmin with sassc-rails
from sassc-rails.
The initializer isn't working for me. I get an error: uninitialized constant SassC
Any idea how I could fix this ? I would really like to use sassc.
from sassc-rails.
Related Issues (20)
- incompatibilty with sprocket 4 HOT 2
- Migration plan now that LibSass is deprecated? HOT 1
- How to pre-compile library?
- Glob Imports Not Working (Workaround Found)
- SIL license used, but not mentioned in LICENSE file HOT 1
- SassC attempts to process each partial individually HOT 1
- unable to resolve type 'size_t' on Apple Silicon Macs HOT 2
- rb_safe_level will be removed in Ruby 3.0 HOT 2
- Sourcemaps aren't available in debug mode with Sprockets 4
- Broken README Link HOT 1
- symbol not found in flat namespace '__ZSt28__throw_bad_array_new_lengthv' HOT 1
- CI: Use a working service
- Cannot load file sass-rails HOT 1
- Upgrade sassc to avoid SIGABRT (code 134) in rake task HOT 4
- Problem with adding a png background HOT 1
- Dead link in README.md HOT 1
- Error in production mode on RoR 7.0.3.1 with Bootstrap 5.2 HOT 6
- freeze HOT 4
- image helpers borked v2.1.2 HOT 1
- Repeated Issue When I Run "rails server"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sassc-rails.