Skip to content
Pete Brousalis edited this page Aug 20, 2014 · 7 revisions

Installation

Add to your Gemfile:

gem 'peteshow'

If you do not want the gem to load in production:

group :development, :test, :staging do
  gem 'peteshow'
end

You can then utilize the peteshow_include_tag helper and config.peteshow.enabled flag. Read more about how they work.

Initializing

To use the helper, you must add to your config/environments/development|test|staging.rb

config.peteshow.enabled = true
config.assets.precompile += %w( peteshow.min.js peteshow.css )

If you have a custom plugin in vendor/assets/javascripts/peteshow.custom.js change the line above to:

config.assets.precompile += %w( peteshow.min.js peteshow.custom.js peteshow.css )

Peteshow is disabled by default (just incase...), so you have to manually enable it using the config.peteshow.enabled flag. With Rails 4.1 changes to sprockets, we must also add the files to the asset pipeline.

You can also make an initializer, config/initializers/peteshow.rb:

Peteshow.configure do |config|
  config.enabled = true
end

Just remember to make sure its disabled in your production environment config.

Helper usage

peteshow_include_tag if defined? peteshow_include_tag

This will include the JS and CSS needed for Peteshow. You can also give it params such as:

peteshow_include_tag 'custom' if defined? peteshow_include_tag

Where custom is your peteshow.custom.js found in vendor/assets/javascripts. Read more about custom plugins

You can also pass it HTML5 attributes:

peteshow_include_tag 'custom', defer: true, async: true if defined? peteshow_include_tag
Clone this wiki locally