Sha256: d8a104921df8d45ef4e6bfc4047c5e48362f3e1cd62bb7d39715dc6f9b268448
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module Stylish class Theme attr_accessor :root, :options, :manifest, :manifest_path, :compiler def initialize(root, options={}) @options = options @root = Pathname(root).expand_path @manifest_path = options.fetch(:manifest_path) { root.join('stylish.yml') } raise 'Manifest file not found. Please provide a root directory in which stylish.json can be found' unless manifest_path.exist? @manifest = Hashie::Mash.new YAML.load_file(manifest_path) setup_compiler rescue nil end def apply_manifest values={} @manifest.merge!(values) end def dependency_paths Array(manifest.dependency_paths).map {|path| root.join(path) } end def import_paths Array(manifest.import_paths).map {|path| root.join(path) } end def setup_compiler @compiler ||= Stylish.sprockets.dup.tap do |env| dependency_paths.each {|p| env.append_path(p) unless env.paths.include?(p.to_s) } if defined?(::Less) (import_paths.map(&:to_s) - Less.paths.map(&:to_s)).each do |path| Less.paths << path end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stylish-0.3.1 | lib/stylish/theme.rb |