Sha256: d4c46cc6d44a906ddd72bda759bc93c32fdc371553f849c8184de4af405cb6c8

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

class <%= @name.camelcase %>::Application
  register Sprockets::Helpers

  set :sprockets, Sprockets::Environment.new
  set :assets_prefix, '/assets'
  set :digest_assets, true

  configure do
    # append assets paths
    sprockets.append_path "app/assets/stylesheets"
    sprockets.append_path "app/assets/javascripts"
    sprockets.append_path "app/assets/images"
    # Other assets path, you can add below
    # sprockets.append_path "app/assets/fonts"

    # compress assets
    sprockets.js_compressor  = :uglify
    sprockets.css_compressor = :scss

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

      # Force to debug mode in development mode
      # Debug mode automatically sets
      # expand = true, digest = false, manifest = false
      config.debug       = true if development?
    end
  end

  helpers do
  include Sprockets::Helpers

    # Alternative method for telling Sprockets::Helpers which
    # Sprockets environment to use.
    # def assets_environment
    #   settings.sprockets
    # end

    # Use:
    # stylesheet_path 'application'
    # javascript_path 'application'
    # as style and js path generator
  end

  # get assets
  get "/assets/*" do
    # if you changed assets_prefix, you need change it here
    env["PATH_INFO"].sub!("/assets", "")
    settings.sprockets.call(env)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aetherg-0.5.1 lib/templates/config/initializers/assets.rb
aetherg-0.5.0 lib/templates/config/initializers/assets.rb
aetherg-0.5.0.beta3 lib/templates/config/initializers/assets.rb
aetherg-0.5.0.beta2 lib/templates/config/initializers/assets.rb