Skip to content

Instantly share code, notes, and snippets.

@BDQ
Created August 31, 2011 08:30
Show Gist options
  • Save BDQ/1183076 to your computer and use it in GitHub Desktop.
Save BDQ/1183076 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'deface'
html = %q{<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]> <html lang="<%= ::I18n.locale %>" class="no-js"> <![endif]-->}
Deface::Parser.erb_markup!(html)
puts "-" * 60
puts %q{<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]> <html lang="<%= ::I18n.locale %>" class="no-js"> <![endif]-->}
puts "-" * 60
doc = Nokogiri::HTML::DocumentFragment.parse(html)
puts Deface::Parser.undo_erb_markup!(doc.to_s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment