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

Defined in:
card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/abstract/bootstrap_code_file.rb

Instance Method Summary collapse

Instance Method Details

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



46
47
48
49
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 46

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



24
25
26
27
28
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 24

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



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

def add_stylesheet filename, type: :scss
  load_from_path "#{mod_path}/lib/stylesheets/#{filename}.#{type}"
end

#add_stylesheet_file(path) ⇒ Object



42
43
44
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 42

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

#bootstrap_pathObject



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

def bootstrap_path
  "#{mod_path}/vendor/bootstrap/scss"
end

#contentObject



15
16
17
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 15

def content
  stylesheets.join "\n"
end

#existing_source_pathsObject



61
62
63
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 61

def existing_source_paths
  []
end

#load_from_path(path) ⇒ Object



51
52
53
54
55
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 51

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

#mod_pathObject



30
31
32
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 30

def mod_path
  mod_root :bootstrap
end

#source_changed(_since:) ⇒ Object



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

def source_changed _since:
  false
end

#stylesheetsObject



19
20
21
22
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bootstrap_code_file.rb', line 19

def stylesheets
  load_stylesheets unless @stylesheets
  @stylesheets
end