Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include css from node_modules in application.scss

The newest Rails release 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 haven't been able to import css files from the installed modules.

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

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

Any ideas on how to get this working?

like image 787
gafemoyano Avatar asked Apr 06 '17 13:04

gafemoyano


1 Answers

I was able to get it working by removing the tilde operator.

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

Apparently I got mislead by the linting options on my editor that insisted on putting it, but the asset pipeline includes the modules for you so there's no need to use it.

like image 109
gafemoyano Avatar answered Sep 29 '22 11:09

gafemoyano