https://github.com/customink/sass_paths
Helper methods to append directories to the SASS_PATH ENV variable
https://github.com/customink/sass_paths
Last synced: 9 months ago
JSON representation
Helper methods to append directories to the SASS_PATH ENV variable
- Host: GitHub
- URL: https://github.com/customink/sass_paths
- Owner: customink
- License: mit
- Created: 2014-09-20T15:33:56.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-08-23T14:31:06.000Z (almost 2 years ago)
- Last Synced: 2025-09-18T03:00:51.413Z (10 months ago)
- Language: Ruby
- Size: 22.5 KB
- Stars: 7
- Watchers: 85
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# SassPaths
This gem provides helper methods for appending directories and gems to the `SASS_PATH` environment variable. This enables you to load
projects that do not themselves register with SASS.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'sass_paths'
```
And then execute:
```shell
$ bundle
```
Or install it yourself as:
```shell
$ gem install sass_paths
```
## Usage
#### Directories
To append a directory, simply call `append` with your list of directories that
you'd like appended.
```ruby
SassPaths.append('/my/first/sass/path', '/my/second/sass/path', ...)
```
#### Gems
In order to append a gem, call `append_gem_path` with the name of the gem as
well as the directory within the gem that contains the Sass files.
```ruby
SassPaths.append_gem_path(gem_name, directory)
```
#### Temporary Replacements
Sometimes it can be fun to change the Sass paths for the duration of a block. For example, this would swap out using [Neat](http://neat.bourbon.io) versions.
```ruby
replacements = {
"/gems/neat-1.8.0/app/assets/stylesheets" => "/gems/neat-2.0.0/core"
}
SassPaths.with_replacements(replacements) do
options = { load_paths: Sass.load_paths }
Sass::Engine.new(template, options).render
end
```
The `with_replacements` takes no responsiblity for knowing about the paths passed in as being valid or not.
### Rails
Create an initializer and utilize the above methods.
### Not Rails
Use the above methods in some part of your application's boot process.
## Testing
* Run `bundle install` to install development dependencies.
* Run `rake test` to run all tests.