Sha256: 25e8a0cb1c24923996e6234264f566957524059fb7067597f1436efcc61b8fc9

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

if defined?(::Sinatra)
  module Sinatra
    module Reustyle
      def self.registered app
        app.set :root, Dir.pwd
        app.set :sprockets, ::Reustyle.sprockets_env
        app.set :assets_prefix, %w(assets)
        app.set :assets_path, File.join(app.root, "app", app.assets_prefix.join)
        app.set :public_folder, File.join(app.root, "public")
        app.set :assets_helper_path, "/assets"
        app.set :static, true
        app.set :assets_digest, true

        # Setup Sprockets
        ::Reustyle.asset_directories.each do |asset_directory|
          app.sprockets.append_path File.join(app.assets_path, asset_directory)
        end

        Sprockets::Helpers.configure do |config|
          config.environment = app.sprockets
          config.prefix      = app.assets_helper_path
          config.digest      = app.assets_digest
          config.public_path = app.public_folder
        end

        require 'autoprefixer-rails'
        AutoprefixerRails.install(app.sprockets, ::Reustyle.autoprefixer_config)

        app.helpers Sprockets::Helpers
      end
    end
    register Reustyle
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reustyle-2.0.11 lib/reustyle/sinatra.rb
reustyle-2.0.10 lib/ustyle/sinatra.rb