Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

copy images from css too when going static #82

Merged
merged 1 commit into from

2 participants

@andersjanmyr

Images used in the css, url(my/nice/image.png) needs to be copied when
we are creating a static presentation.

@schacon schacon referenced this pull request from a commit
@schacon Merged pull request #82 from andersjanmyr/copy-images-from-css-when-s…
…tatic.

copy images from css too when going static
d3dda18
@schacon schacon merged commit d3dda18 into schacon:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 14, 2011
  1. @andersjanmyr
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/showoff.rb
View
12 lib/showoff.rb
@@ -361,6 +361,18 @@ def self.do_static(what)
FileUtils.makedirs(File.join(file_dir, dir))
FileUtils.copy(File.join(pres_dir, path), File.join(file_dir, path))
end
+ # copy images from css too
+ 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|
+ p path
+ dir = File.dirname(path)
+ FileUtils.makedirs(File.join(file_dir, dir))
+ FileUtils.copy(File.join(pres_dir, path), File.join(file_dir, path))
+ end
+ end
+ end
end
end
Something went wrong with that request. Please try again.