Created
March 27, 2012 00:35
-
-
Save allansideas/2211041 to your computer and use it in GitHub Desktop.
Little util for extracting fontsquirrel fontpacks renaming url( to font_url( for scss, and creating a fonts.css.scss file with all style rules. Put zips and script in vendor fonts, run, and copy fonts.css.scss to stylesheets dir and include in applicatio
This file contains 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
#!/usr/bin/env ruby | |
#Extracts files to current dir, substitutes url( for font_url( and appends stylesheet to fonts.css.scss | |
completed_files = Array.new | |
current_directory = Dir.getwd | |
File.open('fonts.css.scss', "w") {} | |
Dir.foreach(current_directory) do |file_name| | |
if (file_name.include?(".zip") && !completed_files.include?(file_name)) | |
system("unzip -o #{file_name}") | |
completed_files << file_name | |
style = File.read('stylesheet.css') | |
style = style.gsub(/url\(/, "font_url(") | |
File.open('fonts.css.scss', "a") do |f| | |
puts style | |
f << style | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment