DEV Community


Writing code block highlighting to a CSS file with Rouge.

Konnor Rogers
Full stack ruby on rails web developer
・1 min read


To remind myself how to do this again in the future.

How to do it?

To append a Rouge theme to an existing file you can do the following:

gem install rouge

require "rouge"
theme ="<path-to-file>", "a+") { |f| f.write(theme) }
Enter fullscreen mode Exit fullscreen mode

All themes

Discussion (0)