Skip to content
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

NameError: uninitialized constant Sprockets::SafetyColons #416

Closed
blanchma opened this issue Nov 3, 2016 · 5 comments
Closed

NameError: uninitialized constant Sprockets::SafetyColons #416

blanchma opened this issue Nov 3, 2016 · 5 comments

Comments

@blanchma
Copy link

blanchma commented Nov 3, 2016

Expected behavior

In previous version, I could unregister SafetyColons.

Actual behavior

NameError: uninitialized constant Sprockets::SafetyColons

System configuration

  • 3.7.0
  • MRI 2.2.0

Example App

Rake::SprocketsTask.new do |t|
environment = Sprockets::Environment.new( File.expand_path(File.dirname(FILE)) )
environment.unregister_postprocessor 'application/javascript', Sprockets::SafetyColons
#environment.js_compressor = :uglifier
environment.append_path Bower.environment.directory
environment.append_path 'app/assets/javascripts'
environment.append_path 'app/assets/webpack'
environment.append_path 'app/assets/stylesheets'

#environment.append_path 'public/assets'
t.environment = environment
t.output = "./public/assets"
t.assets = %w( all.js all.css )
end

@gilesbowkett
Copy link

I expanded this out into a full example app here:

https://github.com/gilesbowkett/sprockets-issue-416

it uses Rails 4.2, since you said you're on Ruby 2.2.0, and Rails 5 requires 4.2.2.

I saw the same error you did, I'm just setting this up as a convenience for the maintainers.

@blanchma
Copy link
Author

blanchma commented Nov 3, 2016

Thanks. I'm running this in a Cuba (almost vainilla Rake).

@gilesbowkett
Copy link

fwiw, I don't think Sprockets uses the SafetyColons processor any more. I couldn't find it anywhere in the source.

there is a lib/sprockets/utils.rb file with a string_end_with_semicolon? method, though, and there's also an "appends missing semicolons" test in test/test_asset.rb. So my guess is the SafetyColons functionality got moved somewhere else.

@gilesbowkett
Copy link

also, removing the implementation of string_end_with_semicolon? causes 85 test fails. that's about all I know at the moment.

@TylerHorth
Copy link

It looks like SafetyColons was removed sometime after sprockets 2.

@blanchma Could you explain your use case, why do you want to unregister it?

Semicolon insertion currently needs to be reworked, as it is breaking source maps [#388]. It may be the case that the solution to that fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants