jekyll-less
jekyll-less copied to clipboard
Error: uninitialized class variable @@mtimes
I just installed jekyll-less, and then: gem install jekyll-less
, added gem "jekyll-less"
to my Gemfile, added "- jekyll-less
" to _config.yml, and ran bundle update
. When I try to serve the website, I see :
bundle exec jekyll serve
Configuration file: /Users/dagoodma/Documents/web/davie-goodman.com/_config.yml
Configuration file: /Users/dagoodma/Documents/web/davie-goodman.com/_config.yml
Source: /Users/dagoodma/Documents/web/davie-goodman.com
Destination: /Users/dagoodma/Documents/web/davie-goodman.com/_site
Incremental build: disabled. Enable with --incremental
Generating...
jekyll 3.3.1 | Error: uninitialized class variable @@mtimes in Jekyll::Less::LessCssFile
Did you mean? mtimes
This error is supposed to be fixed in pull request #14
i added this to _plugins/jekyll-less.rb
:
require "jekyll-less"
@@mtimes = {}
and this resolved it for me. hope that helps.
@ebaizel I tried your suggestion, and I get a warning that looks like .../_plugins/jekyll-less.rb:2: warning: class variable access from toplevel
. I'm not familiar with Ruby, but it looks like @@
signifies a class variable. In your case how can you be modifying a class variable like that when you're apparently outside of a class definition and not referring to an instance of that class? Or more importantly, any ideas how to fix my problem?
@benlindsay You have to initialize this variable inside the LessCssFile class (example).
@sfi0zy Thanks for the example! So I put ruby '2.5.1'
and gem 'jekyll-less', github: 'sfi0zy/jekyll-less'
in my Gemfile
and
plugins:
- "jekyll-less"
in my _config.yml
, have nothing in my _plugins
folder. This got rid of the uninitialized class variable @@mtimes
error, but now when I try to build with a css
folder that looks like this, it builds the solarized.less
file just fine but won't build my style.less
file, giving a bunch of errors like this:
Less Exception: variable @alert-padding is undefined
Less Exception: variable @font-size-small is undefined
Less Exception: variable @breadcrumb-padding-vertical is undefined
Less Exception: .border-right-radius is undefined
Less Exception: variable @padding-base-vertical is undefined
Less Exception: .transition is undefined
Less Exception: .opacity is undefined
Less Exception: variable @font-family-monospace is undefined
Less Exception: .transition is undefined
...
Any thoughts of what's going wrong? Thanks again for your help!
@benlindsay
Any thoughts of what's going wrong?
Only one file of the bootstrap can be compiled (bootstrap.less
), but Jekyll-less tries to compile every of them. The readme says:
Place .less files anywhere in your Jekyll project's directory. These will be converted to .css files with the same directory path and filename. For example, if you create a Less file at css/my-stuff/styles.less, then the corresponding css file would end up at css/my-stuff/styles.css.
In the result you see the first error for every *.less file that it can't compile. Variable "alert-padding" is undefined in alerts.less
, "font-size-small" is undefined in badges.less
etc. I can't reproduce these errors right now, but I think that they shouldn't affect the style.less
.
Ahh, so there's no way to, for example, just tell it to compile style.less
, which imports variables from a bunch of other files? The weird thing is that it doesn't actually convert my style.less
file for some reason. I just switched to this plugin and it works, so I figure I'll just stick with that. Thanks for the help!