Open phiggins opened 8 years ago
Would be great if #85 could be merged.
@phiggins For your workaround to work, you need to use prepend
instead of include
:
# config/initializers/sassc.rb
require 'sassc'
SassC::Engine.prepend(Module.new do
def precision
super || 10
end
end)
Also due to missing parenthesis what you're actually calling is Engine.include(Module.new) do .. end
which does nothing at all.
This works as well:
# config/initializers/sassc.rb
if defined?(SassC)
class SassC::Engine
def precision
8
end
end
end
Followup to our twitter conversation earlier today: https://twitter.com/pete_higgins/status/747861010359402496
I am switching a rails app from using sass-rails to sassc-rails and looking for differences in the compiled CSS between the two. I noticed that sass has many more degrees of precision from the results of doing math in sass than sassc does. Sass has the option to specify the precision, which bootstrap-sass relies on: https://github.com/twbs/bootstrap-sass/blob/0a64ad76107e0363e0d504287c0f9b88c6679399/lib/bootstrap-sass.rb#L64-L65 This means that whne using sassc some of the derived values have a much lower precision which can lead to small differences cropping up, as mentioned in the issue linked to in the bootstrap-sass documentation above. Even if there are no visible differences, since I am switching from sass-rails to sassc-rails, I'd feel more confident that nothing was going to change between the two of them if their compiled CSS was the same, minus whitespace differences, etc.
For now I've been able to change the precision with sassc-rails by adding a monkeypatch like this to my project, which is not ideal: