Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Load depending on environment, to work with Compass or Rails.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycreates committed Aug 26, 2014
1 parent 5ca21d1 commit af99dec
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in bootswatch-rails.gemspec
# Specify your gem's dependencies in bootswatch-sass.gemspec
gemspec
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bootswatch-rails
# bootswatch-sass

[![Gem Version](https://badge.fury.io/rb/bootswatch-rails.svg)](http://badge.fury.io/rb/bootswatch-rails)

Expand All @@ -12,7 +12,7 @@ bootstrap itself.

Add this line to your application's Gemfile, in assets group:

gem 'bootswatch-rails'
gem 'bootswatch-sass'

And then execute:

Expand Down
18 changes: 0 additions & 18 deletions bootswatch-rails.gemspec

This file was deleted.

21 changes: 21 additions & 0 deletions bootswatch-sass.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bootswatch-sass/version'

Gem::Specification.new do |gem|
gem.name = "bootswatch-sass"
gem.version = Bootswatch::VERSION
gem.authors = ["Maxim Chernyak","Esteban Arango Medina"]
gem.email = ["[email protected]","[email protected]"]
gem.description = %q{Bootswatches converted to SCSS ready to use in Compass or Rails projects.}
gem.summary = %q{Bootswatches in Compass or Rails projects}
gem.homepage = "http://github.com/anthonycreates/bootswatch-sass"

gem.add_dependency 'bootstrap-sass'
gem.add_dependency 'activesupport', '~> 3.2.0'
gem.add_dependency 'rake', '>= 0.8.7'

gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.require_paths = ["lib"]
end
5 changes: 0 additions & 5 deletions lib/bootswatch-rails/version.rb

This file was deleted.

58 changes: 58 additions & 0 deletions lib/bootswatch-sass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module Bootswatch
class << self
# Inspired by Bootstrap Sass
def load!
register_rails_engine if rails?
configure_sass
end

# Paths
def gem_path
@gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end

def stylesheets_path
File.join assets_path, 'stylesheets'
end

def fonts_path
File.join assets_path, 'fonts'
end

def javascripts_path
File.join assets_path, 'javascripts'
end

def assets_path
@assets_path ||= File.join gem_path, 'vendor', 'assets'
end

# Environment detection helpers
def asset_pipeline?
defined?(::Sprockets)
end

def compass?
defined?(::Compass)
end

def rails?
defined?(::Rails)
end

private

def configure_sass
require 'sass'

::Sass.load_paths << stylesheets_path
end

def register_rails_engine
require 'bootswatch-sass/engine'
end
end
end

Bootswatch.load!

2 changes: 0 additions & 2 deletions lib/bootswatch-rails.rb → lib/bootswatch-sass/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'bootswatch-rails/version'

module Bootswatch
module Rails
class Engine < ::Rails::Engine
Expand Down
3 changes: 3 additions & 0 deletions lib/bootswatch-sass/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Bootswatch
VERSION = '3.2.0.1'
end

0 comments on commit af99dec

Please sign in to comment.