Created
September 14, 2012 20:16
-
-
Save derek-watson/3724453 to your computer and use it in GitHub Desktop.
Strip all inline style attributes from HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - Reads from STDIN until EOF | |
# - Writes to STDOUT. | |
# - Requires Nokogiri (gem install nokogiri) | |
# | |
# Hi Tom! | |
require 'nokogiri' | |
doc = Nokogiri::HTML.parse(STDIN.read) | |
doc.css('[style]').each do |node| | |
node.delete 'style' | |
end | |
puts doc.to_s |
tadman
commented
Sep 14, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment