module Almanack::ServerContext::Environment
Public Instance Methods
auto_render_asset(*args)
click to toggle source
# File lib/almanack/server/environment.rb, line 23 def auto_render_asset(*args) auto_render_template locate_asset(*args) end
auto_render_template(asset)
click to toggle source
# File lib/almanack/server/environment.rb, line 17 def auto_render_template(asset) renderer = asset.extname.split(".").last content = asset.read respond_to?(renderer) ? send(renderer, content) : content end
basename(file)
click to toggle source
# File lib/almanack/server/environment.rb, line 4 def basename(file) Pathname(file).split.last.to_s.split(".", 2).first end
locate_asset(name, within: path)
click to toggle source
# File lib/almanack/server/environment.rb, line 8 def locate_asset(name, within: path) name = basename(name) path = settings.root.join(within) available = Pathname.glob(path.join("*")) asset = available.find { |path| basename(path) == name } raise "Could not find stylesheet #{name} inside #{available}" if asset.nil? asset end
register_sass_loadpaths!()
click to toggle source
# File lib/almanack/server/environment.rb, line 31 def register_sass_loadpaths! if !SassC.load_paths.include?(theme_stylesheet_path) SassC.load_paths << theme_stylesheet_path end end
theme_stylesheet_path()
click to toggle source
# File lib/almanack/server/environment.rb, line 27 def theme_stylesheet_path settings.root.join('stylesheets') end