Sprockets 4 Compatibility by schneems · Pull Request #65 · sass/sassc-rails (original) (raw)

I did a bundle open added some debugging and ran tests.

It looks like no transformer is running, not the sassc-rails one nor the built in Sprockets one on these 9 failing tests.

In the loader right after we set processors I added

puts "======"
puts unloaded.compressed_path.inspect
puts processors.inspect

When I run sprockets tests I get results like this

======
"test/fixtures/sass/paths.scss?type=text/css&pipeline=self"
[#<Proc:0x007f94233c1248@/Users/richardschneeman/Documents/projects/sprockets/test/sprockets_test.rb:84>, #<struct Sprockets::ProcessorUtils::CompositeProcessor processor_strategy=#<Proc:0x007f9422070b08@/Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/processor_utils.rb:22 (lambda)>, param=[#<Sprockets::Preprocessors::DefaultSourceMap:0x007f9423459188>, #<Sprockets::DirectiveProcessor:0x007f9423482df8 @header_pattern=/\A(?:(?m:\s*)(?:(?:\/\/.*\n?)+|(?:\/\*(?m:.*?)\*\/)))+/>, Sprockets::ScssProcessor], processors=[#<Sprockets::Preprocessors::DefaultSourceMap:0x007f9423459188>, #<Sprockets::DirectiveProcessor:0x007f9423482df8 @header_pattern=/\A(?:(?m:\s*)(?:(?:\/\/.*\n?)+|(?:\/\*(?m:.*?)\*\/)))+/>, Sprockets::ScssProcessor]>, #<Sprockets::DirectiveProcessor:0x007f9422ac6eb8 @header_pattern=/\A(?:(?m:\s*)(?:(?:\/\/.*\n?)+|(?:\/\*(?m:.*?)\*\/)))+/>, Sprockets::FileReader]

You can see where the Sprockets::ScssProcessor is being used.

However when I do the same with the scss-rails test suite I get results like this:

======
"app/assets/stylesheets/syntax_error.scss?type=text/scss"
[#<Sprockets::DirectiveProcessor:0x007fa1dac3e410 @header_pattern=/\A(?:(?m:\s*)(?:(?:\/\/.*\n?)+|(?:\/\*(?m:.*?)\*\/)))+/>, Sprockets::FileReader]

I think the difference is that Sprockets 4 will actually render your .scss file. Not the difference in the type= between the two one is text/css which works correctly the other is text/scss which isn't triggering the transformers.

So

new_css_output = render_asset("glob_test.scss")

In the tests should be

new_css_output = render_asset("glob_test.css")