Project

csslite

0.0
No commit activity in last 3 years
No release in over 3 years
An experimental gem to parse CSS and propagate the style attributes for the associated nodes using the selectors
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Introducing the CSSLite gem

require 'domle'
require 'csslite'

s = "b {background-color: #ff3322 }"
xml = "<a><b>red</b><b2>green</b2><b>blue</b></a>"

doc = Domle.new(xml)
css = CSSLite.new s
css.propagate doc.root

puts doc.root.xml pretty: true
<a style=''>
  <b style='background-color:#ff3322'>red</b>
  <b2 style=''>green</b2>
  <b style='background-color:#ff3322'>blue</b>
</a>

Resources

css csslite gem style stylesheet