Sha256: eac8902c91db913a09d4d90206db263eddad83abd2a69b6e79880aab1c8d3b18

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

require_relative "../exstatic_assets.rb"

module Sinatra
  module Exstatic
    # Extends the Asset class, for using types of format
    # other than mtime_int
    # Just require this file and then use the format of your choice.
    # @example
    #
    #   require 'sinatra/exstatic_assets/formats'
    #
    #   configure do
    #     # Set all timestamps to use SHA1 of the file.
    #     app.set :timestamp_format, :sha1
    #   end
    #
    #   # or just call it on an individual basis:
    #   stylesheet_tag "css/main.css", timestamp_format: :sha1
    module Formats

      def sha1
        Digest::SHA1.file(fullpath).hexdigest
      end
    
    end

    class Asset
      include Formats
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinatra-exstatic-assets-3.1.1 lib/sinatra/exstatic_assets/formats.rb
sinatra-exstatic-assets-3.1.0 lib/sinatra/exstatic_assets/formats.rb