Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper rails support #29

Merged
merged 1 commit into from
Aug 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/vital.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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