ghoppe / refinerycms-tinymce

TinyMCE Editor support for RefineryCMS
7 stars 21 forks source link

Precompilation fails in production using Refinery 4 and 5.2 #7

Open Obi-TOB opened 6 years ago

Obi-TOB commented 6 years ago

RAILS_ENV=production bundle exec rake assets:precompile

[...]
[SassC::FunctionsHandler] undefined method `[]' for nil:NilClass
rake aborted!
SassC::SyntaxError: Error: error in C function asset-path: undefined method `[]' for nil:NilClass
        on line 5 of ../../../../.rbenv/versions/2.5.1/gemsets/rails52/bundler/gems/refinerycms-tinymce/app/assets/stylesheets/tinymce.scss, in function `asset-path`
        from line 5 of ../../../../.rbenv/versions/2.5.1/gemsets/rails52/bundler/gems/refinerycms-tinymce/app/assets/stylesheets/tinymce.scss
>> @import url(asset-path("tinymce/skins/lightgray/content.min.css"));

   ------------^
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/bundler/gems/refinerycms-tinymce/app/assets/stylesheets/tinymce.scss:5
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/gems/sassc-1.12.1/lib/sassc/engine.rb:47:in `render'
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/gems/sassc-rails-1.3.0/lib/sassc/rails/template.rb:34:in `block in call'
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/gems/sprockets-3.7.2/lib/sprockets/utils.rb:171:in `module_include'
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/gems/sassc-rails-1.3.0/lib/sassc/rails/template.rb:33:in `call'
/home/thomas/.rbenv/versions/2.5.1/gemsets/rails52/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:30:in `call'
[...]

I'm stuggling to find out what the issue might be: Maybe sine change in the dependency management in the asset pipeline...

Strangly RAILS_ENV=production bundle exec rake assets:precompile

works fine, but I can't see any setting that might affect this.

Any idea where to look?

WvanLelyveld commented 5 years ago

We are experiencing the same issue, and seems to appear pretty randomly. Most of the times it passes correctly, but sometimes this error appears. Wonder if anyone has a clue why this happens.

SEAFERN commented 5 years ago

I am getting exactly the same error with heroku deployment.

WvanLelyveld commented 5 years ago

Ah, I might have found the issue. It's using sass helpers in .css files. Make sure all files you use helpers in are names .scss, not .css.

See https://stackoverflow.com/questions/12313612/rake-assetsprecompile-undefined-method-for-nilnilclass/42530190 for more info

batshoes commented 5 years ago

All my files are .scss and I'm getting the same issue.

Error: error in C function asset-path: undefined method `[]' for nil:NilClass
on line 201 of app/assets/stylesheets/scaffold/_forms.scss, in function `asset-path`
from line 201 of app/assets/stylesheets/scaffold/_forms.scss
from line 34 of app/assets/stylesheets/application.scss
>     background-image: url(asset-path("icon-remove-bullet.svg"));

Not using Refinery but this only happens on push to prod. RAILS_ENV=production rake assets:precompile reveals nothing. Interestingly, this doesn't break the icon in production. Any ideas where to start?