Sha256: adb66c89586bb31dca207dc1435d6aceaa136bb0b37a06f37f9fd04d53dd30e3

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

#!/usr/bin/env rake

# Rake tasks
namespace :material_icons do
  #
  # Get the CSS to use unicode instead of ligatures.
  #
  desc "Create the CSS Unicode classes"
  task :unicode_css do
    # Check codepoint file
    unless File.exist?('codepoints')
      puts 'Codepoints file is required to perform this operation.'
      puts 'Go to: https://github.com/google/material-design-icons and download it.'
    else
      # Destination file
      out = File.new("unicode.css", "w")

      # Load from codepoints 
      File.readlines('codepoints').each do |line|
        el = line.split(' ')
        css_class = el.first.gsub('_', '-')
        unicode = el.last
        # Need this strange indentation for CSS...
        css =
<<-FOO
.material-icons.mi-#{css_class}:before,
.mi.mi-#{css_class}:before {
  content: '\\#{unicode}';
}
FOO
        # Print in the file
        out.puts css
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
material_icons-0.0.6 Rakefile