Sha256: 0205d573d755d715e4239d5b6f4b75ef3542f1e862a70677b589b118bae8025e

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

def self.included host_class
  host_class.include_set Abstract::CodeFile
  host_class.mattr_accessor :stylesheets_dir, :bootstrap_path, :mod_path
  host_class.mod_path = File.join Cardio.gem_root, "mod", host_class.file_content_mod_name
  host_class.stylesheets_dir = File.join host_class.mod_path, "lib", "stylesheets"
  host_class.bootstrap_path = File.join host_class.mod_path, "vendor", "bootstrap", "scss"
end

def add_bs_subdir sub_dir
  Dir.glob("#{bootstrap_path}/#{sub_dir}/*.scss").each do |path|
    load_from_path path
  end
end

def add_stylesheet filename, type: :scss
  load_from_path File.join(stylesheets_dir, "#{filename}.#{type}")
end

def add_stylesheet_file path
  load_from_path File.join(mod_path, path)
end


def add_bs_stylesheet filename, type: :scss, subdir: nil
  path = File.join(*[bootstrap_path, subdir, "_#{filename}.#{type}"].compact)
  load_from_path path
end

def load_from_path path
  @stylesheets ||= []
  Rails.logger.info "reading file: #{path}"
  @stylesheets << File.read(path)
end

def stylesheets
  load_stylesheets unless @stylesheets
  @stylesheets
end

view :raw do |_args|
  card.stylesheets.join "\n"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-1.93.0 mod/bootstrap/set/abstract/bootstrap_code_file.rb