rails6 导入js依赖库css样式

Posted 学者先要会疑

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rails6 导入js依赖库css样式相关的知识,希望对你有一定的参考价值。

If you have upgraded your app from an earlier version of Rails make sure you add the following line:

 

 Rails.application.config.assets.paths << Rails.root.join(‘node_modules‘) in config/initializers/assets.rb.

 

This is included by default in the newly generated apps.

Then in 

app/javascripts/packs/application.sass the following should do the job:
@import ‘font-awesome/css/font-awesome‘; (no ~ and no file extension)

以上是关于rails6 导入js依赖库css样式的主要内容,如果未能解决你的问题,请参考以下文章

VS Code中自定义Emmet代码片段

js外部样式如何导入

django 使用Media类导入css与js

react js上的样式导入(使用webpack)

vue项目导入外部css样式和js文件

Rails 6 无法导入纱线依赖项:未捕获错误:模块解析失败:意外字符“#”(1:0)