Module: Sass::Script::Functions

Includes:
Compass::RailsImageFunctionPatch
Included in:
EvaluationContext
Defined in:
lib/compass-rails4/patches.rb,
lib/compass-rails4/patches.rb

Instance Method Summary collapse

Instance Method Details

#asset_url(path) ⇒ Object



17
18
19
20
# File 'lib/compass-rails4/patches.rb', line 17

def asset_url(path)
  context = CompassRails4.context.new(CompassRails4.sprockets, path.value, path.value)
  Sass::Script::String.new("url(" + context.asset_path(path.value) + ")")
end

#cachebust_generated_imagesObject



11
12
13
14
15
# File 'lib/compass-rails4/patches.rb', line 11

def cachebust_generated_images
  generated_images_path = CompassRails4.root.join(Compass.configuration.generated_images_dir).to_s
  sprockets_entries = CompassRails4.sprockets.send(:trail).index.instance_variable_get(:@entries)
  sprockets_entries.delete(generated_images_path) if sprockets_entries.has_key? generated_images_path
end

#generated_image_url(path, only_path = nil) ⇒ Object



6
7
8
9
# File 'lib/compass-rails4/patches.rb', line 6

def generated_image_url(path, only_path = nil)
  cachebust_generated_images
  asset_url(path)
end