Skip to content

Commit

Permalink
Support Sprockets without Rails and Hanami
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
glebm committed Dec 17, 2017
1 parent 56cd034 commit 6a3f299
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/popper_js.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# frozen_string_literal: true

require 'popper_js/version'
require 'popper_js/engine' if defined?(Rails)

if defined?(::Rails)
require 'popper_js/engine'
else
gem_path = File.expand_path('..', File.dirname(__FILE__))
assets_path = File.join(gem_path, 'assets')
if defined?(::Sprockets)
Sprockets.append_path(File.join(assets_path, 'javascripts'))
elsif defined?(::Hanami)
Hanami::Assets.sources << assets_path
end
end

0 comments on commit 6a3f299

Please sign in to comment.