Adding stylesheets path to Sass.load_paths for non Rails apps #161

Merged
merged 1 commit into from Feb 1, 2013

4 participants

@ysbaddaden
Contributor

Here is a tiny patch that adds Bourbon's stylesheets path to Sass.load_paths for non Rails apps to be able to use the stylesheets from the gem, instead of copying and updating them manually into each project.

@ysbaddaden ysbaddaden Adding stylesheets path to Sass.load_paths
Adding the stylesheets path to Sass' load_paths allows non Rails
apps to use the assets bundled with the gem directly, instead of
copying them manually into each projects, and manually updating
them.
b7abce3
@plapier plapier merged commit e30ab9b into thoughtbot:master Feb 1, 2013
@plapier
Contributor
plapier commented Feb 10, 2013

@ysbaddaden, I'm just getting around to testing this (oops, it should have been done before pushing a new version). Have you had success in getting this working in a non-rails app? I can't seem to get it to pull from the gem using @import 'bourbon' or @import 'bourbon/bourbon', after removing the bourbon directory from a project.

Do you have any insight?

@ysbaddaden
Contributor

@plapier of course, I should have given some examples before.

Here is an example using Sass::Plugin::Rack, which is what this pull request meant to simplify: https://gist.github.com/ysbaddaden/4750870

You may also use the command line, using a Gemfile then running something like:

bundle exec sass -r 'bourbon' --watch assets/stylesheets:public/stylesheets

It's a bit complicated for everyday use, but useful for building static assets in a cap deploy.

@hakanensari

@plapier I believe this makes the non-Rails installation directions in the README obsolete.

@plapier plapier referenced this pull request in thoughtbot/neat Feb 22, 2013
Merged

Add stylesheets path to Sass.load_paths #64

@hakanensari

Silly me. I skipped the fact that we have Sprockets set up in the Sinatra app I was incorporating Bourbon. It didn't occur to me that without an asset pipeline, the instructions still hold.

@plapier
Contributor
plapier commented Feb 22, 2013

@hakanensari, no. If I understand correctly, this doesn't makes the non-rails installation obsolete. I think they have different uses.

This feature is great for tying the bourbon gem into other non-rails web apps, like Sinatra.

Otherwise, generating bourbon files into your static project is helpful for maintaining the correct bourbon version over time.

Cheers @ysbaddaden! Nice work and thanks a ton!

@runemadsen

For those who are looking for a solution to setting Bourbon and Neat up with Sprockets and the sinatra-asset-pipeline gem, I made a small repo example here: https://github.com/runemadsen/sinatra-asset-pipeline-bourbon-neat

@plapier
Contributor
plapier commented Oct 18, 2014

Thank you @runemadsen! I added your repo to the Sinatra wiki page. Feel free to edit or add any details you wish. https://github.com/thoughtbot/bourbon/wiki/Sinatra

@runemadsen

Awesome! I spent so long trying to manually paste in the bourbon folder, trying different @import statements, but realized that it can load the assets directly from the gem if you know how to set it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment