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
patches/sass_importer incorrect method usage #195
Comments
This is giving me: For some reason, |
@ollym Do you have the line number and the source file in your error message? |
This fixes the "wrong number of arguments" error from latest compass-rails 2.0.1 used together with sprockets 2.12.3. See: Compass/compass-rails#195
This is causing spree-frontend to error out too. Same |
+1 |
For anyone having this issue I have a pull request that fixes this #197 Feel free to set your Rails gemfile with the line |
@danielpclark solution worked for me. # Gemfile
ruby '2.2.0'
gem 'rails', '4.2.0.rc3'
gem 'sass-rails', '~> 5.0.0'
gem 'compass-rails', github: 'danielpclark/compass-rails'
gem 'susy', '~> 2.1.0' // application.scss
@charset "utf-8";
@import "compass/css3";
@import "compass/utilities";
@import "susy";
@import "scaffolding" // _scaffolding.scss
body {
color: #333;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
background-color: #fff;
} Change I should also mention that compass-core throw me a warning: |
@colderis I believe I know why this may be happening. In my code I used Sprockets::Cache::VERSION as the version parameter. I'll look into putting the actual compiled sass resource(s) version info here. This will, should, fix your issue with not updating compiled resources. Let me look into it and I'll get back to you. |
@colderis Alright I've fixed it. I've used the same context.environment variable that was used in the previous method/version. Now any changes in your CSS/SCSS files get updated immediately. |
It didn't came from your changes. Actually the line you mention wasn't called at all. This code does the same thing for me: def evaluate(context, locals, &block)
cache_store = self.class.parent::CacheStore.new(context.environment)
paths = context.environment.paths.map { |path| CompassRails::SpriteImporter.new(context, path) }
paths += context.environment.paths.map { |path| self.class.parent::SassImporter.new(path) }
paths += ::Rails.application.config.sass.load_paths
options = CompassRails.sass_config.merge( {
:filename => eval_file,
:line => line,
:syntax => syntax,
:cache_store => cache_store,
:importer => self.class.parent::SassImporter.new(context.pathname),
:load_paths => paths,
:sprockets => {
:context => context,
:environment => context.environment
}
})
::Sass::Engine.new(data, options).render
rescue ::Sass::SyntaxError => e
# Annotates exception message with parse line number
context.__LINE__ = e.sass_backtrace.first[:line]
raise e
end What fixes the issue is replacing engine = ::Sass::Engine.new(data, options)
css = engine.render
engine.dependencies.map do |dependency|
context.depend_on(dependency.options[:filename])
end
css Then I just filtered, within the I'll try to find a proper solution. |
The code you've pasted is from the main source without any of my changes. My tests in my development environment work for me. I don't know of an easy way of detecting what's going on in it. I've just been reading the code and going with what I understand of it. Then I've tried to see what works. Could you share with me how you know about:
and
The original errors I pasted here showed that these lines (the ones I've updated) are called. I was unable to use the pry gem to break into the code execution and test the local environment variables and state. So I really would like to know how you're finding out such things. It'll be a great help! |
Fixes Compass#195 (works with latest Sass and Sprockets)
My pull request currently loads application.css just fine. The require's aren't getting pulled in though. It needs to be updated further. |
@colderis I believe you are right about where the problem now lies. I've been looking into ... |
Hi Guys, I've been having the same 2 bugs, the first @danielpclark highlighted in this issue for about a week and the second one @colderis reported for about 2 months now. My 2 cents: The second poped up 2 months ago for me when I needed to use @danielpclark's pull fixes the Thanks for all your hard work! |
Thanks @complistic-gaff. When you say you need to delete temp files and restart the server is that in the development environment, or just production? @colderis I've found a tool to debug with: Looking at the Could you tell me what you expect the behavior to be when it works rather than:
What role is |
@danielpclark delete/restart in development... in production I need to precompile/restart (as normal). FYI: I have a main @import "_fonts"
@import "_framework_and_overrides"
@import "_layout"
@import "_facilities" Then each of the sass files includes the compass bits it needs. |
@complistic-gaff Are your |
@danielpclark, Everything loads and works fine after I delete the temp files then restart the server. If I don't do that, only updates to the main For example if I make changes to |
@danielpclark If I make a change to both This sounds like I will try Monkey Patching the code in from @colderis to see is it helps. |
Yep, forking your code and adding @colderis patch "fixed" the problem for me. |
@danielpclark yes I used byebug. And the first block of code is simply the fix for the first issue without all the backward compatibility stuff (I just realised it's pretty much what @hsbt wrote in his pull request #194). The problem is simple, compass-rails isn't compatible with sass-rails 5.x. |
@complistic-gaff I looked more into the patch @colderis shared with me which comes from rails/sass-rails#283 . I'm thinking there might be a little more to do then just engine = ::Sass::Engine.new(data, options)
css = engine.render
engine.dependencies.map do |dependency|
context.depend_on(dependency.options[:filename])
end
css The context of this original patch had other work involved. I'll only be working on this during weekends. So more later. |
@danielpclark yeah I just wanted to confirm that I have both of your problems, and that @colderis issue popped up when I started to use I agree that there is more to be done on the dependencies issue, just wanted to give some background and comformation. |
The breaking change is in sass-rails -- Between v5.0.0.beta1 and v5.0.0, it stopped stomping on the inherited initializer. Downgrading sass-rails to v5.0.0.beta1 fixes the issue for me, temporarily. rails/sass-rails@91f7509eb12d3e3f9f9dc564570f8f5dbf3b8c0aL141 |
Please see #201. I cherry-picked and squashed @danielpclark's work and also turned the test suite green while added new tests to cover the scenario that everyone is currently suffering from. I could use some help reviewing and testing the pull-request: gem "compass-rails", github: "rmm5t/compass-rails", branch: "sass-rails-5.0" UPDATE: The PR was merged. Use this instead: gem "compass-rails", github: "Compass/compass-rails", branch: "master" |
Fix confirmed. (sorry, previous phrasing was unclear.) |
I can confirm it @cflipse. If you put this in your gemfile
then this issue has been repaired. The current gem 2.0.1 does not include this patch. The discussion further down in this thread about secondary CSS/SCSS files not being included has been moved into new issue #208 |
Apply a version of colderis patch from issue #195
+1 on fix, cheers. |
Use version 2.0.2 |
https://github.com/Compass/compass-rails/blob/master/lib/compass-rails/patches/sass_importer.rb
and line 21
I tracked this down. Each library brings the class in via
SassImporter < Sass::Importers::Filesystem
. In Sass the code reads as follows:Source: https://github.com/sass/sass/blob/stable/lib/sass/importers/filesystem.rb#L14
For (2) the source method reads:
Source: https://github.com/sstephenson/sprockets/blob/2c9333bd1b6a55f791a3f2ca1389bf152cea18ba/lib/sprockets/sass_processor.rb#L260
I'm using Ruby 2.2.0.preview1, Rails 4.2.0.rc3. And using:
gem 'compass-rails', '
> 2.0.1'> 3.0.0.beta.6'gem 'sprockets', '
gem 'sass-rails', '
> 5.0.0'> 3.4.9'gem 'sass', '
The text was updated successfully, but these errors were encountered: