Module: Card::Set::Abstract::BootstrapCodeFile::OverrideCodeFile

Defined in:
tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb

Instance Method Summary collapse

Instance Method Details

#add_bs_stylesheet(filename, type: :scss, subdir: nil) ⇒ Object



42
43
44
45
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 42

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

#add_bs_subdir(sub_dir) ⇒ Object



28
29
30
31
32
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 28

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

#add_stylesheet(filename, type: :scss) ⇒ Object



34
35
36
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 34

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

#add_stylesheet_file(path) ⇒ Object



38
39
40
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 38

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

#contentObject



19
20
21
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 19

def content
  stylesheets.join "\n"
end

#existing_source_pathsObject



57
58
59
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 57

def existing_source_paths
  []
end

#load_from_path(path) ⇒ Object



47
48
49
50
51
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 47

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

#source_changed(_since:) ⇒ Object



53
54
55
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 53

def source_changed _since:
  false
end

#stylesheetsObject



23
24
25
26
# File 'tmpsets/set/mod026-bootstrap/abstract/bootstrap_code_file.rb', line 23

def stylesheets
  load_stylesheets unless @stylesheets
  @stylesheets
end