Skip to content

ehrenmurdick/css_writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS::Writer is for generating CSS from ruby code, similar in appearance to markaby. 

Example:

require 'css_writer'

writer = CSS::Writer.new
writer.css do
  body do
    backgroundColor 'red'
  end

  div '.class' do
    fontWeight 'bold'
  end

  div do
    input do
      color '#eee'
    end
  end
end
writer.render

Produces:
body {
  background-color: red;
}
div.class {
  font-weight: bold;
}
div input {
  color: #eee;
}

You can also pass true into #render resulting in a cheap minification of the output css a la:

writer.render(true)

Resulting in:

body{background-color:red;}div.class{font-weight:bold;}div input{color:#eee;}

About

CSS::Writer, write css using ruby syntax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages