Ortuna / padrino-pipeline

Sprockets for padrino apps
MIT License
21 stars 8 forks source link

Padrino Pipeline

Padrino Pipeline is a gem for Padrino. It provides a unified way to use several different asset management systems.

Build Status Code Climate Dependency Status

Supported Pipelines

Simple Usage

Gemfile

Add to your Gemfile:

gem 'padrino-pipeline'

These examples examples setup a pipeline with defaulted options(see default options):

Sprockets pipeline

module Example
  class App < Padrino::Application
    register Padrino::Pipeline
    configure_assets do |config|
      config.pipeline = Padrino::Pipeline::Sprockets
    end
  end
end

Sinatra AssetPack pipeline

module Example
  class App < Padrino::Application
    register Padrino::Pipeline
    configure_assets do |config|
      config.pipeline = Padrino::Pipeline::AssetPack
    end
  end
end

Options

Certain options can be configured to change the behavior of the pipelines. These options should be used within the configure_assets block.

for example:

module Example
  class App < Padrino::Application
    register Padrino::Pipeline
    configure_assets do |config|
      config.pipeline = Padrino::Pipeline::AssetPack
      config.css_prefix = '/xyz'
    end
  end
end

The following options can be set

Pipeline

Assets URI(mounting location) String

Asset location(path to files) String/Array

Prefix prepend this prefix before all assets

Default option values

TODO

Asset pack packages

  module Example
    class App < Padrino::Application
      register Padrino::Pipeline
      configure_assets do |config|
        config.pipeline   = Padrino::Pipeline::AssetPack
        config.packages << [:js, :application, '/assets/javascripts/application.js', ['/assets/javascripts/*.js']]
      end
    end
  end

Will serve /assets/javascripts/application.js as a bundle

Sprocket directive require/include/require tree

TODO