middleman / middleman-syntax

Code syntax highlighting plugin via Rouge for Middleman
https://middlemanapp.com
MIT License
179 stars 57 forks source link

uninitialized constant #<Class:...>::Rouge #45

Closed mehulkar closed 9 years ago

mehulkar commented 9 years ago

Gemfile

# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source 'http://rubygems.org'

gem "middleman", "~>3.3.5"
gem "middleman-syntax"

# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"

# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]

# Windows does not come with time zone data
gem "tzinfo-data", platforms: [:mswin, :mingw]

gem 'rake'
/* source/stylesheets/syntax.css.erb */
<%= Rouge::Themes::ThankfulEyes.render(:scope => '.highlight') %>
<!-- source/layouts/layout.erb -->
<%= stylesheet_link_tag "all", "new", "syntax" %>

I must be doing something silly, but I don't quite understand how middleman works.

Arcovion commented 9 years ago

Is activate :syntax in your config.rb?

mehulkar commented 9 years ago

Got it working. I had put activate :syntax inside the configure :build block. Didn't realized activate directives could live outside blocks also. Thanks!

extractachris commented 9 years ago

I am getting this as well:

My Gemfile:

source 'http://rubygems.org'

gem "middleman", "3.3.10"

gem "puma"

# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]

# Windows does not come with time zone data
gem "tzinfo-data", platforms: [:mswin, :mingw]

# Syntax
gem "middleman-syntax", "2.0.0"
gem "redcarpet", "2.3.0"

# Code beautification
gem 'htmlbeautifier', '~> 0.0.9'

From my terminal when I run $ grunt:

/.rvm/gems/ruby-1.9.3-p194/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:20: warning: already initialized constant KEYWORDS
/.rvm/gems/ruby-1.9.3-p194/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:25: warning: already initialized constant BUILTINS

I have activate :syntax set in my config.rb.

In my Gemfile.lock file, I notice Rouge loads twice:

middleman-syntax (2.0.0)
      middleman-core (~> 3.2)
      rouge (~> 1.0)
rouge (1.9.1)
Arcovion commented 9 years ago

@extractachris That's just a warning, you can safely ignore it. Ref: https://github.com/jneen/rouge/pull/291

extractachris commented 9 years ago

Thanks, @Arcovion. FWIW, I dropped back down to rouge 1.8.0 and the warning went away:

gem 'rouge', '1.8.0'