Module: RailsSassImages

Defined in:
lib/rails-sass-images/railtie.rb,
lib/rails-sass-images.rb,
lib/rails-sass-images/version.rb

Overview

Copyright 2013 Andrey “A.I.” Sitnik <[email protected]>, sponsored by Evil Martians.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: Sass Classes: Engine, Railtie

Constant Summary collapse

VERSION =
'0.3'.freeze

Class Method Summary collapse

Class Method Details

.asset(path) ⇒ Object

Return asset by file ‘path` from Sass parser



23
24
25
26
27
28
# File 'lib/rails-sass-images.rb', line 23

def self.asset(path)
  path  = path.value
  asset = self.assets[path]
  raise "Can't find asset #{path}" unless asset
  asset
end

.assetsObject

Get Sprockets environment



42
43
44
# File 'lib/rails-sass-images.rb', line 42

def self.assets
  @assets
end

.assets=(env = nil) ⇒ Object

Set Sprockets environment



37
38
39
# File 'lib/rails-sass-images.rb', line 37

def self.assets=(env = nil)
  @assets = env
end

.install(sprockets) ⇒ Object

Set Sprockets environment and add Rails Sass Images styles paths



31
32
33
34
# File 'lib/rails-sass-images.rb', line 31

def self.install(sprockets)
  sprockets.append_path(Pathname(__FILE__).dirname.join('assets/stylesheets'))
  self.assets = sprockets
end