Load, parse and cascade CSS rule sets in Ruby.
Install the gem from RubyGems.
gem install css_parser
An example
require 'css_parser'
include CssParser
parser = CssParser::Parser.new
parser.load_file!('http://example.com/styles/style.css')
# lookup a rule by a selector
parser.find('#content')
#=> 'font-size: 13px; line-height: 1.2;'
# lookup a rule by a selector and media type
parser.find('#content', [:screen, :handheld])
# iterate through selectors by media type
parser.each_selector(:screen) do |selector, declarations, specificity|
...
end
Made on Vancouver Island.
Commercial Use
Modify
Distribute
Sub-License
Private Use
Hold Liable
Include Copyright
Include License
These details are provided for information only. No information here is legal advice and should not be used as such.
There are no reported vulnerabilities
30 Day SummaryDec 18 2023 — Jan 17 2024
|
12 Month SummaryJan 17 2023 — Jan 17 2024
|