class Bowerify::AssetsProcessor
Constants
- CSS_URL_RE
Public Instance Methods
bower_component?(path)
click to toggle source
# File lib/bowerify/assets_processor.rb, line 26 def bower_component?(path) bower_components_paths.each do |bower_path| if path.to_s.starts_with?(bower_path) return true end end false end
bower_components_paths()
click to toggle source
# File lib/bowerify/assets_processor.rb, line 36 def bower_components_paths Array(Rails.application.config.bower_components_path).map(&:to_s) end
evaluate(context, locals={})
click to toggle source
# File lib/bowerify/assets_processor.rb, line 4 def evaluate(context, locals={}) if bower_component?(context.pathname) fix_assets_path data, context else data end end
fix_assets_path(data, context)
click to toggle source
# File lib/bowerify/assets_processor.rb, line 12 def fix_assets_path(data, context) data.gsub CSS_URL_RE do |*args| s1, s2 = $1.dup, $6.dup path = File.expand_path("#{context.pathname.dirname}/#{$3}") bower_components_paths.each do |bower_path| path = path.gsub("#{bower_path}/", "") end path = context.asset_path(path) "#{s1}#{path}#{s2}" end end