Skip to content

Commit

Permalink
Merge pull request #29 from doximity/proper-rails-support
Browse files Browse the repository at this point in the history
Proper rails support
  • Loading branch information
fgrehm committed Aug 5, 2016
2 parents 6d4e18c + c9f5e9d commit f41c7f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/vital.rb
Expand Up @@ -6,7 +6,9 @@ class << self
def load!
register_compass_extension if compass?

if sprockets?
if rails?
register_rails_engine
elsif sprockets?
register_sprockets
end

Expand All @@ -23,6 +25,10 @@ def sass_path
end

# Environment detection helpers
def rails?
defined?(::Rails)
end

def sprockets?
defined?(::Sprockets)
end
Expand All @@ -41,6 +47,10 @@ def configure_sass
def register_sprockets
Sprockets.append_path(sass_path)
end

def register_rails_engine
require 'vital/engine'
end
end
end

Expand Down
10 changes: 10 additions & 0 deletions lib/vital/engine.rb
@@ -0,0 +1,10 @@
module Vital
class Engine < ::Rails::Engine
isolate_namespace Vital

initializer 'vital.assets' do |app|
app.config.assets.paths << "#{Vital.gem_path}/fonts"
app.config.assets.precompile += %w( icons.* )
end
end
end

0 comments on commit f41c7f0

Please sign in to comment.