Module: RailsSassImages
- Defined in:
- lib/rails-sass-images.rb,
lib/rails-sass-images/railtie.rb,
lib/rails-sass-images/version.rb
Defined Under Namespace
Modules: Sass Classes: Engine, Railtie
Constant Summary collapse
- VERSION =
'0.5'.freeze
Class Method Summary collapse
-
.asset(path) ⇒ Object
Return asset by file ‘path` from Sass parser.
-
.install(sprockets) ⇒ Object
Set Sprockets environment and add Rails Sass Images styles paths.
-
.load_from ⇒ Object
Get Sprockets environment or assets dir path.
-
.load_from=(source) ⇒ Object
Set Sprockets environment or assets dir path.
Class Method Details
.asset(path) ⇒ Object
Return asset by file ‘path` from Sass parser
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails-sass-images.rb', line 5 def self.asset(path) path = path.value @load_from = @load_from.call() if @load_from.is_a? Proc if @load_from.is_a? Pathname asset = @load_from.join(path) raise "Can't find asset #{path} in #{@load_from}" unless asset.exist? elsif sprockets? @load_from asset = @load_from[path] raise "Can't find asset #{path}" unless asset asset = asset.pathname end asset end |
.install(sprockets) ⇒ Object
Set Sprockets environment and add Rails Sass Images styles paths
23 24 25 26 |
# File 'lib/rails-sass-images.rb', line 23 def self.install(sprockets) sprockets.append_path(Pathname(__FILE__).dirname.join('assets/stylesheets')) @load_from = sprockets end |
.load_from ⇒ Object
Get Sprockets environment or assets dir path
35 36 37 |
# File 'lib/rails-sass-images.rb', line 35 def self.load_from @load_from end |
.load_from=(source) ⇒ Object
Set Sprockets environment or assets dir path
29 30 31 32 |
# File 'lib/rails-sass-images.rb', line 29 def self.load_from=(source) source = Pathname(source) if source.is_a? String @load_from = source end |