Closed abemedia closed 6 years ago
Hi @abeMedia, can you run it again with --trace
and give us the full exception? That would better help me figure out where the problem originates and if it's an upstream problem or if it originates in our LESS plugin (which I would hope it wouldn't...)
Hi @envygeeks, Sorry about the late reply! Here is the full exception I get when turning on CSS compression:
Liquid Exception: undefined method `gsub' for nil:NilClass in /_layouts/default.html
/home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-assets-2.2.8/lib/jekyll/assets/liquid/tag.rb:222:in `capture_and_out_error': undefined method `gsub' for nil:NilClass (NoMetho
dError)
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-assets-2.2.8/lib/jekyll/assets/liquid/tag.rb:102:in `rescue in render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-assets-2.2.8/lib/jekyll/assets/liquid/tag.rb:91:in `render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:151:in `render_token'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:5:in `block in render_token_with_profiling'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/profiler.rb:80:in `profile_token_render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:4:in `render_token_with_profiling'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:135:in `block in render_all'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `each'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `render_all'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:108:in `render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:210:in `block in render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:262:in `with_profiling'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:209:in `render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:222:in `render!'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/liquid_renderer/file.rb:28:in `block (2 levels) in render!'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/liquid_renderer/file.rb:40:in `measure_bytes'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/liquid_renderer/file.rb:27:in `block in render!'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/liquid_renderer/file.rb:47:in `measure_time'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/liquid_renderer/file.rb:26:in `render!'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/renderer.rb:114:in `render_liquid'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/renderer.rb:157:in `place_in_layouts'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/renderer.rb:71:in `run'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:447:in `block (2 levels) in render_docs'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:445:in `each'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:445:in `block in render_docs'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:444:in `each'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:444:in `render_docs'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:190:in `render'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/site.rb:69:in `process'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/command.rb:26:in `process_site'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/commands/build.rb:63:in `build'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/commands/build.rb:34:in `process'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/lib/jekyll/commands/build.rb:16:in `block (2 levels) in init_with_program'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /home/koding/.rvm/gems/ruby-2.3.0/gems/jekyll-3.2.1/exe/jekyll:13:in `<top (required)>'
from /home/koding/.rvm/gems/ruby-2.3.0/bin/jekyll:23:in `load'
from /home/koding/.rvm/gems/ruby-2.3.0/bin/jekyll:23:in `<main>'
from /home/koding/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /home/koding/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Hey @abeMedia,
I just encountered this same issue while using the SASS compressor v3.4.22. Some of the .css
files I was including (via sprockets require statements) had invalid CSS constructs in them. For example, this CSS file is a surefire way to trigger the error:
/**
* Filename: bad-media-queries.css
*/
.example-foo-ul:media(max-width: 123px) li {
display: block;
}
I was able to identify the file(s) which were causing problems by removing all of my require
statements and re-adding them one at a time. It would be nice if the console error included a file:line of the CSS token it got hung up on.
Additionally, you can use the command-line version of your CSS preprocessor to identify any problematic files:
$ scss _assets/stylesheets/bad-media-queries.css
Error: Invalid CSS after "...media(max-width": expected ")", was ": 123px) li"
on line 1 of _assets/stylesheets/bad-media-queries.css
Use --trace for backtrace.
We no longer support LESS. Less support will need to either be provided by Less through Sprockets or be unsupported by our system, we do not feel it's beneficial to support something that is rarely used, it adds extra overhead and development time. Sorry.
Totally understand! By now the vast majority of projects I'm involved in have been migrated to sass anyway...
When turning on CSS compression in any project using LESS I get the following error:
This worked on older jekyll-assets versions using yui-compressor so I asssume it's some issue with SASS...