Method: IsoDoc::Convert#precompiled_style_or_original

Defined in:
lib/isodoc/css.rb

#precompiled_style_or_original(stylesheet_path) ⇒ Object

Check if already compiled version(.css) exists,

if not, return original scss file. During release
we compile scss into css files in order to not depend on scss


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/isodoc/css.rb', line 6

def precompiled_style_or_original(stylesheet_path)
  # Already have compiled stylesheet, use it
  return stylesheet_path if stylesheet_path.nil? ||
    File.extname(stylesheet_path) == ".css"

  basename = File.basename(stylesheet_path, ".*")
  compiled_path = File.join(File.dirname(stylesheet_path),
                            "#{basename}.css")
  return stylesheet_path unless File.file?(compiled_path)

  compiled_path
end