Rails, Sass and Grunt

185 Views Asked by At

I'm trying out switching to using Grunt for all my asset stuff in my Rails app rather than the asset pipeline. (Just a trial, I can dispose of this and go back to asset pipeline at any time)

I have the grunt-contrib-watch plugin watching and compiling my sass files but it's failing with the line:

@import "bourbon"

Grunt does not seem able to find the bourbon files. I have bourbon installed as a gem. I know grunt-contrib-sass has a loadPath option but I am unsure of what to add to this to allow Grunt to see and use the gems installed as part of my bundle?

Any ideas?

2

There are 2 best solutions below

1
On

When you install bourbon you put:

bourbon install;

This command creates a folder named bourbon. and you have to import it using

@import "bourbon/bourbon";

You have to check where is the bourbon folder. And import it.

I think it's not a Grunt problem, because Grunt does not know if a sass code uses bourbon, compasss, susy or whatever.

Regards.

0
On

Solved by using the require option of grunt-contrib-sass:

require: ['bourbon', 'susy', 'breakpoint'],

I now need to find an equivalent for loading in javascripts from ruby gems such as jquery from the jquery gem and jquery-ujs from jquery-rails gem.