Sha256: a21eacdb4b7185dac1b82781f46a423535de3b438f01167a568eb51e5d6b1b26

Contents?: true

Size: 493 Bytes

Versions: 2

Compression:

Stored size: 493 Bytes

Contents

require 'sprockets'
require 'tilt'

module Sprockets
  class SourceURL < Tilt::Template
    self.default_mime_type = 'application/javascript'

    def prepare
    end

    def evaluate(scope, locals, &block)
      code = ''
      code << 'eval('
      code << data.inspect
      code << " + \"\\n//@ sourceURL=/#{scope.logical_path}\""
      code << ");\n"
      code
    end
  end

  if defined?(register_postprocessor)
    register_postprocessor 'application/javascript', SourceURL
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprockets-source-url-0.0.2 lib/sprockets/source_url.rb
sprockets-source-url-0.0.1 lib/sprockets/source_url.rb