Sha256: ac5b8f3d9f8794c1cc0bbcade332aeb4f383935fe06abc1d69a3f36de7edc57d

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

require 'compass'
require 'sass'
require 'sinatra'
require 'sprockets'
require 'sprockets-sass'
require 'compass'
require 'bootstrap-sass'
require 'uglifier'

# encoding: utf-8
module LocalPac
  module App
    class AssetsController < Sinatra::Base
      set :root, ::File.expand_path('../../', __FILE__)
      set :assets, Sprockets::Environment.new(root)
      set :precompile, [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
      set :assets_prefix, '/assets'
      set :digest_assets, false
      set(:assets_path) { ::File.join public_folder, assets_prefix }

      configure :profile do
        require 'ruby-prof'
        use Rack::RubyProf, files: '/tmp/profiles'

        use Rack::CommonLogger, LocalPac::AccessLogger.new(LocalPac.config.access_log)
        set :raise_errors, false
      end

      configure :production do
        use Rack::CommonLogger, LocalPac::AccessLogger.new(LocalPac.config.access_log)
        set :raise_errors, false
      end

      configure :development do
        set :raise_errors, true
      end

      configure :test do
        use Rack::CommonLogger, LocalPac::NullAccessLogger.new
        set :raise_errors, true
      end

      configure do

        # Setup Sprockets
        %w{javascripts stylesheets images fonts}.each do |type|
          assets.append_path "assets/#{type}"
          assets.append_path Compass::Frameworks['bootstrap'].templates_directory + "/../vendor/assets/#{type}"
        end
        assets.cache = Sprockets::Cache::FileStore.new(LocalPac.config.sass_cache)

        # Configure Sprockets::Helpers (if necessary)
        Sprockets::Helpers.configure do |config|
          config.environment    = assets
          config.prefix         = assets_prefix
          config.digest         = digest_assets
          config.public_path    = public_folder
        end

        Sprockets::Sass.add_sass_functions = false
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
local_pac-0.6.3 app/controllers/assets_controller.rb
local_pac-0.6.2 app/controllers/assets_controller.rb
local_pac-0.6.1 app/controllers/assets_controller.rb
local_pac-0.5.0 app/controllers/assets_controller.rb
local_pac-0.4.0 app/controllers/assets_controller.rb
local_pac-0.3.0 app/controllers/assets_controller.rb
local_pac-0.2.3 app/controllers/assets_controller.rb
local_pac-0.2.2 app/controllers/assets_controller.rb
local_pac-0.2.1 app/controllers/assets_controller.rb
local_pac-0.2.0 app/controllers/assets_controller.rb