我正在使用 Syntastic VIM 插件
我所有的 bootstrap 东西都已经设置好并且可以工作了,只是我一直收到这个错误 在 app/assets/stylesheets/application.css.scss
|| File to import not found or unreadable: bootstrap-sprockets. Load path: ... on line 17
第17行是@import "bootstrap-sprockets";
我的 Gemfile 有
gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass', '~> 3.3.3'
我的 app/assets/stylesheets/application.css.scss 有
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
@import "bootstrap-sprockets";
@import "bootstrap";
为什么 Syntastic 仍然给我这个错误?
最佳答案
Why does Syntastic still give me this error?
Syntastic 给你这个错误,因为它不知道 sprockets
设置的额外导入路径。 .但幸运的是,您可以使用变量 g:syntastic_<filetype>_<checker>_args
来配置它.所以在你的情况下你可能应该设置类似
let g:syntastic_scss_sass_args="--load-path path/to/bootstrap-gem/vendor/assets"
或类似的东西。
加糖:可以用https://github.com/embear/vim-localvimrc仅为这个元素自动设置这个变量
关于css - 修复 SyntasticCheck Bootstrap 错误。 Vim 语法插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29041876/