rails / sass-rails

Ruby on Rails stylesheet engine for Sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deprecation warnings with sprockets 3.7.0

maia opened this issue · comments

commented

sass-rails-5.0.5 throws deprecation warnings when using sprockets 3.7.0:

DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /…/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /…/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)

Quick fix for me(for now) was...

gem 'sprockets', '3.6.3'

Same warning in js-routes (railsware/js-routes#201) I suspect a lot of sprockets extensions will be fixing this in similar ways and may benefit from each other's work.

Working on a PR.

commented

@schneems Thanks a lot for solving the issue with the release of 5.0.6!

Thanks all for chiming in. I added some docs to Sprockets guides on master to show how to register an processor across Sprockets 2, 3, and 4. Link: https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors

I also re-wrote the guide to be easier to reference, put the most relevant examples at the top of the sections and added a table of contents at the top. Please take a look and if you have something to add or ways you think the docs could be better open an issue and we can talk about it. I want the process of maintaining Sprockets extensions to be as easy as possible, I'm hoping the docs can smooth out rough edges and cut down on guessing how to write a sprockets plugin.

If you're working on getting rid of deprecations in your own library and having problems, ping me on a pull request.

hey @schneems , I just updated my gem library for the first time in a while and a bunch of css/scss (but not everything) is not loading correctly, and I'm also seeing this error. Is it likely that this is related? I've never really used sprockets before so its not really clear to me why this would be happening.

@calderJamNet if you have a repro example app please put it on github and give me access. If not you can manually specify an older version of sprockets and sass-rails in your Gemfile.lock.

Do you have any more details other than not working correctly?

Hey @schneems, I added you to the repo. Its just a testing ground for front end styles so its kind of a mess. I did however notice the same changes when I updated all the gems in the main repo.

The differences I have noticed so far have only affected "border" and "color" css styles, with the original foundation styles being applied now while before they were being overwritten. They are minor and could be fixed easily with "!important" but I would like to understand why this started happening if possible.

This is how it was before bundle update:
screen shot 2016-08-02 at 10 49 38 pm

This is how it is after:
screen shot 2016-08-02 at 10 49 27 pm

so far I've only noticed it affecting styles for founations ".accordion", so perhaps the issue is routed in something they changed, in which case I apologize for wasting your time.

@calderJamNet i'm back from vacation and will probably have time to look at this sometime this week. I made an issue for a reminder since this issue is "closed" #384

commented

Thanks all for chiming in. I added some docs to Sprockets guides on master to show how to register an processor across Sprockets 2, 3, and 4. Link: https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors

@schneems I haven't customized Sprockets before -- what's the typical file/location that you would place the env conditional code you provide in that link above?

I haven't customized Sprockets before

This deprecation should only come from gems that are customizing sprockets for you, what is the deprecation output say? It should point it at a location, probably from a gem.

@schneems I haven't customized sprockets before this either. How do I view the deprecation output?

@calderJamNet i don't understand the question. If you're using Sprockets 3.7 and using another gem that doesn't support Sprockets 4 yet, then you'll see deprecation output in your output when you build assets or run in development.

  1. Add the sass rails gem to the the GemFile
    a) gem 'sass-rails', '~> 5.0', '>= 5.0.6'

  2. Run gem install sass-rails on the terminal
    a) gem install sass-rails

  3. Run bundle install
    a) bundle install --without production && bundle update