jekyll / jekyll-sass-converter

A Sass converter for Jekyll.

Home Page:http://rubygems.org/gems/jekyll-sass-converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error should report where the problem originated

Krinkle opened this issue · comments

Starting yesterday, it seems that when using the github-pages gem for a simple site with only plain css assets and not using any theme, it consistently fails due to processing some unused scss file from a theme I'm not using.

Gemfile:

source "https://rubygems.org"
ruby RUBY_VERSION

gem "github-pages", group: :jekyll_plugins

group :jekyll_plugins do
   gem "jekyll-feed", "~> 0.9"
   gem "jekyll-redirect-from", "~> 0.13.0"
end

gem 'tzinfo-data'

Gemfile.lock (partial)

GEM
  remote: https://rubygems.org/
  specs:
    ..
    github-pages (187)
      ..
      jekyll (= 3.7.3)
      ..
      jekyll-theme-primer (= 0.5.3)
      ..
    ..
    jekyll (3.7.3)
      ..

PLATFORMS
  ruby

DEPENDENCIES
  github-pages
  jekyll-feed (~> 0.9)
  jekyll-redirect-from (~> 0.13.0)
  tzinfo-data

RUBY VERSION
   ruby 2.5.0p0

BUNDLED WITH
   1.17.1

Output after bundle update && bundle exec jekyll serve --trace

Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss':
Invalid US-ASCII character "\xE2" on line 5

bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
Jekyll::Converters::Scss::SyntaxError: Invalid US-ASCII character "\xE2" on line 5
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:123:in `rescue in convert'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:118:in `convert'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:98:in `block in convert'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:96:in `each'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:96:in `reduce'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:96:in `convert'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:80:in `render_document'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/renderer.rb:62:in `run'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:473:in `block in render_pages'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:471:in `each'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:471:in `render_pages'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:191:in `render'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/site.rb:73:in `process'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/command.rb:28:in `process_site'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/build.rb:65:in `build'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/build.rb:36:in `process'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/serve.rb:93:in `block in start'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/serve.rb:93:in `each'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/serve.rb:93:in `start'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
  /usr/local/lib/ruby/gems/2.5.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /usr/local/lib/ruby/gems/2.5.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /usr/local/lib/ruby/gems/2.5.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /usr/local/lib/ruby/gems/2.5.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /usr/local/lib/ruby/gems/2.5.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/exe/jekyll:15:in `<top (required)>'
  /usr/local/bin/jekyll:23:in `load'
  /usr/local/bin/jekyll:23:in `<top (required)>'

This is surprising because there is no assets/css/style.scss file or even an assets/ sub directory in the directory from which I ran the jekyll command (where _config.yml is located).

To find out what's going on, I locally patched jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb with the following amendment:

         output.sub(BYTE_ORDER_MARK, replacement)
       rescue ::Sass::SyntaxError => e
-        raise SyntaxError, "#{e} on line #{e.sass_line}"
+        raise SyntaxError, "#{e} in file #{e.sass_filename} on line #{e.sass_line}"
       end

Which revealed:

Invalid US-ASCII character "\xE2" in file /usr/local/lib/ruby/gems/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass/primer-support/lib/variables/typography.scss on line 5

The fact that primer is somehow causing issues (installed by default in github-pages, but not used) is its own issue, but this information seems invaluable and should perhaps be included by default?

@Krinkle Will you be able to submit a PR to include your patch to the plugin..?

It looks like the underlying code changed very recently to use a different Sass parser, of which I haven't learned the API yet. But, I'll give it a try.

@Krinkle I ran a sample run with a Jekyll site and our current master. It seems like the move to SassC has already resolved your request.
Refer #85 for related observations..

Okay.