module Luckysheet
Constants
- VERSION
Public Class Methods
assets_path()
click to toggle source
# File lib/luckysheet-sass.rb, line 45 def assets_path @assets_path ||= File.join gem_path, 'assets' end
compass?()
click to toggle source
# File lib/luckysheet-sass.rb, line 54 def compass? defined?(::Compass::Frameworks) end
fonts_path()
click to toggle source
# File lib/luckysheet-sass.rb, line 34 def fonts_path File.join assets_path, 'fonts' end
gem_path()
click to toggle source
Paths
# File lib/luckysheet-sass.rb, line 26 def gem_path @gem_path ||= File.expand_path '..', File.dirname(__FILE__) end
hanami?()
click to toggle source
# File lib/luckysheet-sass.rb, line 62 def hanami? defined?(::Hanami) end
images_path()
click to toggle source
# File lib/luckysheet-sass.rb, line 37 def images_path File.join assets_path, 'images' end
javascripts_path()
click to toggle source
# File lib/luckysheet-sass.rb, line 41 def javascripts_path File.join assets_path, 'javascripts' end
load!()
click to toggle source
Inspired by Kaminari
# File lib/luckysheet-sass.rb, line 6 def load! register_compass_extension if compass? if rails? register_rails_engine elsif hanami? register_hanami elsif sprockets? register_sprockets elsif defined?(::Sass) && ::Sass.respond_to?(:load_paths) # The deprecated `sass` gem: ::Sass.load_paths << stylesheets_path end if defined?(::Sass::Script::Value::Number) ::Sass::Script::Value::Number.precision = [8, ::Sass::Script::Value::Number.precision].max end end
rails?()
click to toggle source
# File lib/luckysheet-sass.rb, line 58 def rails? defined?(::Rails) end
sprockets?()
click to toggle source
Environment detection helpers
# File lib/luckysheet-sass.rb, line 50 def sprockets? defined?(::Sprockets) end
stylesheets_path()
click to toggle source
# File lib/luckysheet-sass.rb, line 30 def stylesheets_path File.join assets_path, 'stylesheets' end
Private Class Methods
register_compass_extension()
click to toggle source
# File lib/luckysheet-sass.rb, line 68 def register_compass_extension ::Compass::Frameworks.register( 'luckysheet', :version => Luckysheet::VERSION, :path => gem_path, :stylesheets_directory => stylesheets_path, :templates_directory => File.join(gem_path, 'templates') ) end
register_hanami()
click to toggle source
# File lib/luckysheet-sass.rb, line 82 def register_hanami Hanami::Assets.sources << assets_path end
register_rails_engine()
click to toggle source
# File lib/luckysheet-sass.rb, line 78 def register_rails_engine require 'luckysheet-sass/engine' end
register_sprockets()
click to toggle source
# File lib/luckysheet-sass.rb, line 86 def register_sprockets Sprockets.append_path(images_path) Sprockets.append_path(fonts_path) Sprockets.append_path(stylesheets_path) Sprockets.append_path(javascripts_path) end