lib/sprockets/sass/importer.rb
# Get the publicly-visible URL for an imported file. This URL is used by
# source maps to link to the source stylesheet. This may return `nil` to
# indicate that no public URL is available; however, this will cause
# sourcemap generation to fail if any CSS is generated from files imported
# from this importer.
#
# If an absolute "file:" URI can be produced for an imported file, that
# should be preferred to returning `nil`. However, a URL relative to
# `sourcemap_directory` should be preferred over an absolute "file:" URI.
#
# @param uri [String] A URI known to be valid for this importer.
# @param sourcemap_directory [String, NilClass] The absolute path to a
#   directory on disk where the sourcemap will be saved. If uri refers to
#   a file on disk that's accessible relative to sourcemap_directory, this
#   may return a relative URL. This may be `nil` if the sourcemap's
#   eventual location is unknown.
# @return [String?] The publicly-visible URL for this file, or `nil`
#   indicating that no publicly-visible URL exists. This should be
#   appropriately URL-escaped.
Get the publicly-visible URL for an imported file. This URL is used by
source maps to link to the source stylesheet. This may return `nil` to
indicate that no public URL is available; however, this will cause
sourcemap generation to fail if any CSS is generated from files imported
from this importer.

If an absolute "file:" URI can be produced for an imported file, that
should be preferred to returning `nil`. However, a URL relative to
`sourcemap_directory` should be preferred over an absolute "file:" URI.
Get the publicly - visible URL for an imported file . This URL is used by source maps to link to the source stylesheet . This may return ` nil ` to indicate that no public URL is available ; however this will cause sourcemap generation to fail if any CSS is generated from files imported from this importer . If an absolute " file : " URI can be produced for an imported file that should be preferred to returning ` nil ` . However a URL relative to ` sourcemap_directory ` should be preferred over an absolute " file : " URI .
def public_url(uri, sourcemap_directory)
        result = "file:///#{uri}"
        result
      end
def public_url ( uri , sourcemap_directory ) result = "file:///#{uri}" result end
Get the publicly-visible URL for an imported file.
Get the publicly - visible URL for an imported file .
# puts "\nIMPORTER\n" # puts "importer: uri=#{uri}" # puts "importer: sourcemap_directory=#{sourcemap_directory}\n" # Default to an absolute path. # ### !!! TESTING RELATIVE PATHS # # importer: uri=C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/assets/assets/bw-repayment-widget/stylesheets/print/_wiwo-results-manager.scss # # importer: sourcemap_directory=C:\Users\Coridyn\WidgetWorks\bankwest\bw-repayment-widget\build\assets\assets\bw-repayment-widget\stylesheets # #importer: uri=                 C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/vendor/assets/wiwo-shared-lib/dist/src/wiwo-shared-lib/stylesheets/debug/debug.css.scss # #importer: sourcemap_directory= C:\Users\Coridyn\WidgetWorks\bankwest\bw-repayment-widget\build\vendor\assets\wiwo-shared-lib\dist\src\wiwo-shared-lib\stylesheets\debug # #importer: uri=                 C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/vendor/assets/wiwo-repayment-widget/dist/src/wiwo-repayment-widget/stylesheets/print.scss # #importer: sourcemap_directory= C:\Users\Coridyn\WidgetWorks\bankwest\bw-repayment-widget\build\assets\assets\bw-repayment-widget\stylesheets # if (sourcemap_directory != nil) #   #begin #     # Normalise to forward-slashes #     result = Pathname.new(uri).relative_path_from(Pathname.new(sourcemap_directory.gsub('\\', '/'))).to_s #     # Replace the file extension. #     result += '.mapped' #     # Ignore a leading 'vendor/assets/' and 'assets/assets/' path too. #     # result.sub!(/..\/vendor\/assets\//, '../../') #     final = result.sub(/..\/assets\/assets\//, '../../assets/') #     final.sub!(/..\/vendor\/assets\//, '../../assets/') #     if (uri.index('_repayment-summary.scss') != nil) #       puts "Rel   path: #{result}" #       puts "Final path: #{final}" #     end #     result = final #   #rescue #   #end # end # Return the generated URL.
The publicly-visible URL for this file, or `nil` indicating that no publicly-visible URL exists. This should be appropriately URL-escaped.
The publicly - visible URL for this file or ` nil ` indicating that no publicly - visible URL exists . This should be appropriately URL - escaped .
String?
uri
A URI known to be valid for this importer.
A URI known to be valid for this importer .
sourcemap_directory
The absolute path to a directory on disk where the sourcemap will be saved. If uri refers to a file on disk that's accessible relative to sourcemap_directory, this may return a relative URL. This may be `nil` if the sourcemap's eventual location is unknown.
The absolute path to a directory on disk where the sourcemap will be saved . If uri refers to a file on disk that ' s accessible relative to sourcemap_directory this may return a relative URL . This may be ` nil ` if the sourcemap ' s eventual location is unknown .