-
Notifications
You must be signed in to change notification settings - Fork 14
Ruby on Rails
Add to your Gemfile:
gem 'peteshow'If you do not want the gem to load in production:
group :development, :test, :staging do
gem 'peteshow'
endYou can then utilize the peteshow_include_tag helper and
config.peteshow.enabled flag. Read more about how they work.
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.enabledflag. 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
endJust remember to make sure its disabled in your production environment config.
peteshow_include_tag if defined? peteshow_include_tagThis 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_tagWhere 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