Sha256: 784b64c5d3da87849d66de7a7b1517078a6f0cf6a3cabc39b1ab2e708c4cac99

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

# Sinatra::AssetHelpers

Pipeline-agnostic Asset Helpers for Sinatra

## Installation

Add this line to your application's Gemfile:

    gem 'sinatra-asset_helpers', require: 'sinatra/asset_helpers'

And then execute:

    $ bundle

## Usage

Once you add it to your modular Sinatra App:

    class App < Sinatra::Base
      register Sinatra::AssetHelpers
    end

You will be able to use the following helper methods in your templates and layout files:

    stylesheet_tag('app.css, 'media')
    # => <link href="/assets/app.css" media="screen" rel="stylesheet">

    javascript_tag('app.js')
    # => <script src="/assets/app.js"></script>

    image_tag('image.png', 'image alt', 'image title')
    # => <img src="/assets/image.png" alt="image alt" title="image title">

## Options

You can set the following options in Sinatra to configure `Sinatra::AssetHelpers`:

    set :assets_path, 'myassets' # defaults to: 'assets'
    set :assets_host, 'https://assets.example.com' # defaults to: ENV['ASSETS_HOST']
    set :manifest_path, '/path/to/manifest.json' # defaults to: "#{settings.root}/public/assets/manifest.json"

## Contributing

1. Fork it ( http://github.com/<my-github-username>/sinatra-asset_helpers/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinatra-asset_helpers-0.0.2 README.md
sinatra-asset_helpers-0.0.1 README.md