From c141ad6211d600e5dca6150a1f36de72ed7717ab Mon Sep 17 00:00:00 2001 From: Paul C Pederson Date: Tue, 31 Mar 2015 18:02:13 -0700 Subject: [PATCH] calcite web now works as a compass extension via a ruby gem --- README.md | 14 ++++++++++++-- calcite-web.gemspec | 2 +- docs/source/get-started/_ruby-gem.md | 21 +++++++++++++++------ lib/calcite-web.rb | 18 +++--------------- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0aef47e75..74f057a77 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,23 @@ gem "calcite-web", :git => "https://github.com/Esri/calcite-web.git", :tag => "c Be sure to use the replace `current.tag.version` with [the most up to date tag](https://github.com/Esri/calcite-web/releases). -Then in your project's sass file, just import it: +This makes Calcite Web available as a Compass extension. To use Calcite Web, make sure you require the gem in your compass config file (usually found at `config/compass.rb`). an example config file might look like this: + +```ruby +require 'calcite-web' + +css_dir = "stylesheets" +sass_dir = "sass" +``` + +Then in your project's sass files, just import it: ``` @import "calcite-web"; ``` -That will give you everything including sass utilities. You will also need to copy over the JavaScript and image assets to your static folder (see above). +That will give you everything including sass utilities. You will also need to copy over the JavaScript and image assets to your static folder (see above). If you're installing Calcite Web as a gem, it will automatically inc + ## NPM diff --git a/calcite-web.gemspec b/calcite-web.gemspec index f2cc9013a..0a180ee8f 100644 --- a/calcite-web.gemspec +++ b/calcite-web.gemspec @@ -12,5 +12,5 @@ Gem::Specification.new do |s| s.files = ["lib/calcite-web.rb"] s.homepage = package["homepage"] - s.add_dependency "sass", "~> 3.4.1" + s.add_dependency "compass", "~> 1.0.3" end diff --git a/docs/source/get-started/_ruby-gem.md b/docs/source/get-started/_ruby-gem.md index e044f1cb0..89ba697e8 100644 --- a/docs/source/get-started/_ruby-gem.md +++ b/docs/source/get-started/_ruby-gem.md @@ -1,16 +1,25 @@ ## Ruby Gem -To install Calcite Web as a ruby gem, add a reference of the gem to your Gemfile: +To install Calcite-Web as a ruby gem, reference the gem from your `Gemfile`: -```ruby -gem "calcite-web", :git => "https://github.com/Esri/calcite-web.git", :tag => "v0.0.10" ``` +gem "calcite-web", :git => "https://github.com/Esri/calcite-web.git", :tag => "current.tag.version" +``` + +Be sure to use the replace `current.tag.version` with [the most up to date tag](https://github.com/Esri/calcite-web/releases). + +This makes Calcite Web available as a Compass extension. To use Calcite Web, make sure you require the gem in your compass config file (usually found at `config/compass.rb`). an example config file might look like this: -Be sure to use the most [up-to-date tag](https://github.com/Esri/calcite-web/releases). +```ruby +require 'calcite-web' + +css_dir = "stylesheets" +sass_dir = "sass" +``` -Then in your project's Sass file, just import it: +Then in your project's sass files, just import it: -```scss +``` @import "calcite-web"; ``` diff --git a/lib/calcite-web.rb b/lib/calcite-web.rb index a915bb571..944da2217 100644 --- a/lib/calcite-web.rb +++ b/lib/calcite-web.rb @@ -1,15 +1,3 @@ -# find the 'lib' directory and also the stylesheets directory -base_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) -stylesheets_path = File.join(base_directory, 'sass') - -# if using compass, register as a compass extension -if (defined? Compass) - Compass::Frameworks.register('calcite-web', :stylesheets_directory => stylesheets_path) -else - # if not, register on the Sass path via the environment. - if ENV.has_key?("SASS_PATH") - ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + stylesheets_path - else - ENV["SASS_PATH"] = stylesheets_path - end -end \ No newline at end of file +require 'compass' +dir = File.join(File.dirname(__FILE__), '..', 'lib', 'sass') +Compass::Frameworks.register('calcite-web', :stylesheets_directory => dir)