class Makimono::Style

Constants

PRESETS

Public Class Methods

from_style_config(style_config) click to toggle source
# File lib/makimono/style.rb, line 9
def self.from_style_config(style_config)
  path = if PRESETS.include?(style_config)
           File.expand_path("../styles/#{style_config}.css", __dir__)
         elsif File.file?(style_config.to_s)
           File.expand_path(style_config.to_s)
         else
           raise InvalidStyleError, "Style file `#{style_config}` does not exist"
         end

  new(File.basename(path), File.read(path))
end

Public Instance Methods

relative_path_from(dir) click to toggle source
# File lib/makimono/style.rb, line 21
def relative_path_from(dir)
  Pathname.new(path).relative_path_from(dir)
end