dhulihan
dhulihan

Reputation: 11293

Importing rails-assets.org stylesheets from SCSS

Is it possible to import a stylesheet from a rails-assets.org gem using scss's import instead of sprocket's require? For example:

Given this Gemfile:

source 'https://rails-assets.org'
gem "rails-assets-RRSSB"

Using a sprockets stylesheet, normally you'd use a require in application.css (working):

*= require RRSSB/scss/rrssb

However, I'm using SCSS and would like to use import in application.css.scss (not working):

@import "RRSSB/scss/rrssb";

Upvotes: 1

Views: 265

Answers (1)

Oded Niv
Oded Niv

Reputation: 2727

  1. Go to your rvm gem directory (rvm gemdir) and look for the gem rails-assets pulled (/gems/rails-assets-YOUR_GEM-VERSION).
  2. In the app/assets/stylesheets directory find your file.
  3. Import/require the file with the path relative to app/assets/stylesheets.

The same goes for javascripts (in app/assets/javascripts).

This worked for me with rails-assets-bootstrap-sass-official, the file I was trying to import was bootstrap-sporckets and it was (including all other files) under app/assets/stylesheets/bootstrap-sass-official so my import was:

@import "bootstrap-sass-official/bootstrap-sprockets"

Upvotes: 2

Related Questions