Include css from node_modules in application.scss

New Rails 5.1.0.rc1 includes bin / yarn by default. This allows you to install npm modules out of the box. Currently importing javascript files from application.js seems to work fine, but I was unable to import css files from installed modules.

The approach I've tried is using the tilde opperator to let SASS know that it should be a module:

@import "~owlcarousel-pre/owl-carousel/owl.carousel";

      

Any ideas on how to do this?

+3


source to share


1 answer


I managed to get it to work by removing the tilde operator.

@import "owlcarousel-pre/owl-carousel/owl.carousel";

      



Apparently I was confused by the listing options in my editor that insisted on putting it in, but the asset pipeline includes modules for you, so there is no need to use it.

+4


source







All Articles