Skip to content
Create a CSS template from an HTML file
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
README.md
gem-public_cert.pem
html-to-css.gemspec

README.md

Introducing the HTML-to-CSS gem

require 'hlt'
require 'html-to-css' 

s =<<S
html {lang: 'en'}
  head
    title Example for HTML-to-CSS
    meta {charset: 'utf-8'}

  body
    #wrap
      article
        h1 testing 123
        p Having fun today.      
S

File.write 'index2.html', Hlt.new(s).to_html

htc = HtmlToCss.new(file: 'index2.html')
puts htc.to_layout
html {
  background-color: #d5c832
}
  body {
    background-color: #bf71c3;
    align: center
  }
    #wrap {
      background-color: #53d35c
    }
puts htc.to_style
html {
  background-color: #ea4ff5
}
  body {
    background-color: #58e977
  }
    #wrap {
      background-color: #3fdd1e
    }
      #wrap>article {
        background-color: #d25eca
      }
        #wrap>article>h1 {
          background-color: #2c25bb;
          color: #fff;
          font-family: Verdana, Arial, Helvetica, sans-serif;
          font-size: 1.3em
        }
        #wrap>article>p {
          background-color: #51f73b
        }

htmltocss gem css css3

You can’t perform that action at this time.