Class: Conjoin::Assets::App

Inherits:
Cuba
  • Object
show all
Defined in:
lib/conjoin/assets.rb

Overview

scss.render

Instance Method Summary collapse

Methods inherited from Cuba

initialize!, root, root=, settings=

Instance Method Details

#add_asset(file, ext) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/conjoin/assets.rb', line 165

def add_asset file, ext
  dir     = ''
  new_ext = false

  case ext
  when 'css'
    dir     = !file[/^bower/] ? 'stylesheets/' : ''
    new_ext = 'scss' if stylesheet_assets.include? file + '.scss'
  when 'js'
    dir     = !file[/^bower/] ? 'javascripts/' : ''
    new_ext = 'coffee' if javascript_assets.include? file + '.coffee' \
                       or javascript_head_assets.include? file + '.coffee'
  end

  if new_ext
    render "#{Assets.app.root}/app/assets/#{dir}#{file}.#{new_ext}"
  else
    File.read "#{Assets.app.root}/app/assets/#{dir}#{file}.#{ext}"
  end
end