Module: WebifyRuby

Defined in:
lib/webify_ruby.rb,
lib/webify_ruby/css.rb,
lib/webify_ruby/tasks.rb,
lib/webify_ruby/errors.rb,
lib/webify_ruby/convert.rb,
lib/webify_ruby/railtie.rb,
lib/webify_ruby/version.rb

Overview

Public: Main module that you should be using to use this library. You will be mainly using Convert class that lives here. You can use module’s Css class too if customization is required.

Examples

WebifyRuby::Css.new('name', 'file.ttf', :svg, :woff)
# => #<WebifyRuby::Css:0x007ff9e31dcf60>

Defined Under Namespace

Classes: Convert, Css, Error, Railtie

Constant Summary collapse

EXT =

Internal: File extensions that are allowed to be processed

%w(.ttf .otf)
TEMPLATE =

Internal: Template which is according to what a CSS Styles will be generated. This might change in future versions, so that you will be able to pass in your own template definitions.

<<-CSS.gsub /^\s*/, ''
@font-face {
  font-family: '<%= @name %>';
  <% if has_eot %>src: url('<%= @url %>.eot'); <% end %>
  <% if has_eot %>src: url('<%= @url %>.eot?#iefix') format('embedded-opentype')<%if has_ttf or has_woff or has_svg %>,<%end%><%else%>src:<% end %>
      <% if has_svg %>     url('<%= @url %>.svg#<%= @name %>') format('svg')<%if has_ttf or has_woff %>,<%end%><% end %>
      <% if has_woff %>     url('<%= @url %>.woff') format('woff')<%if has_ttf%>,<%end%><% end %>
      <% if has_ttf %>     url('<%= @url %>.ttf') format('truetype')<% end %>;
  font-weight: normal;
  font-style: normal;
}
CSS
VERSION =

Public: WebifyRuby version

"0.0.4"

Class Method Summary collapse

Class Method Details

.load_tasksObject

Internal: Loads rake tasks

Returns nothing



5
6
7
# File 'lib/webify_ruby/tasks.rb', line 5

def self.load_tasks
  Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f; }
end

.loggerObject

Internal: Gets a Logger object to use for logging

Returns the Logger object



42
43
44
45
46
47
# File 'lib/webify_ruby.rb', line 42

def self.logger
  return @logger if @logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::INFO
  @logger = logger
end

.logger=(log) ⇒ Object

Public: Set your own logger if wanted

log - The Logger object.

Examples

WebifyRuby::logger = Logger.new(STDOUT)
# => #<Logger:0x007fd740837ec0

Returns the set logger



35
36
37
# File 'lib/webify_ruby.rb', line 35

def self.logger=(log)
  @logger = log
end

.webify_binaryObject

Internal: Gets a String object pointing to the binary

Returns the String of executable



66
67
68
# File 'lib/webify_ruby.rb', line 66

def self.webify_binary
  @webify_binary || 'webify'
end

.webify_binary=(bin) ⇒ Object

Public: Set a correct webify binary path to use

bin - The String object with path to binary file. (default: ‘webify’)

Examples

WebifyRuby::webify_binary = '/usr/bin/webify'
# => "/usr/bin/webify"

Returns the given binary path



59
60
61
# File 'lib/webify_ruby.rb', line 59

def self.webify_binary=(bin)
  @webify_binary = bin
end