Module: Embork::Sprockets::Frameworks

Included in:
Environment
Defined in:
lib/embork/sprockets/frameworks.rb

Instance Method Summary collapse

Instance Method Details

#load_bootstrap_framework(sprockets_environment) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/embork/sprockets/frameworks.rb', line 14

def load_bootstrap_framework(sprockets_environment)
  base = nil
  begin
    require('compass')
    require('bootstrap-sass')
    base = File.join Compass::Frameworks['bootstrap'].path, 'vendor/assets'
  rescue LoadError => e
    begin
      require('bootstrap-sass')
      base = File.join(Gem::Specification.find_by_name('bootstrap-sass').gem_dir, 'vendor/assets')
    rescue LoadError => e
      (@logger ||= Embork::Logger.new(STDOUT, :simple)).error 'Compass gem is not installed.'
      @logger.info %{Add `gem 'bootstrap-sass'` to your Gemfile and run `bundle` to install it.}
      exit 1
    end
  end

  %w(stylesheets javascripts fonts).each do |type|
    sprockets_environment.append_path File.join(base, type)
  end
end

#load_compass_framework(sprockets_environment) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/embork/sprockets/frameworks.rb', line 2

def load_compass_framework(sprockets_environment)
  begin
    require 'compass'
    sprockets_environment.append_path Compass::Frameworks['compass'].stylesheets_directory
    Compass.configuration.images_path = File.join sprockets_environment.root, 'static', 'images'
  rescue LoadError => e
    (@logger ||= Embork::Logger.new(STDOUT, :simple)).error 'Compass gem is not installed.'
    @logger.info %{Add `gem 'compass'` to your Gemfile and run `bundle` to install it.}
    exit 1
  end
end