Permalink
Browse files

Exclude external assets in the regex.

  • Loading branch information...
1 parent 66162e2 commit 0b6803a118facbcb9ab1a039ef461748b601cdf3 @goncalossilva goncalossilva committed Mar 5, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/showoff.rb
View
@@ -545,8 +545,7 @@ def self.do_static(what)
Dir.glob("#{pres_dir}/*.css").each do |css_path|
File.open(css_path) do |file|
data = file.read
- data.scan(/url\([\"\']?(.*?)[\"\']?\)/).flatten.each do |path|
- next if path.match('^http')
+ data.scan(/url\([\"\']?(?!https?:\/\/)(.*?)[\"\']?\)/).flatten.each do |path|
path.gsub!(/(\#.*)$/, '') # get rid of the anchor
path.gsub!(/(\?.*)$/, '') # get rid of the query
logger.debug path

0 comments on commit 0b6803a

Please sign in to comment.