css - 修复 SyntasticCheck Bootstrap 错误。 Vim 语法插件

标签 css ruby-on-rails syntastic

我正在使用 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/

相关文章:

html - 创建位于屏幕下方的页脚元素

ruby-on-rails - 八哥 : How to speed up the queue

ruby-on-rails - Heroku:错误-/bin/sh:1:npm:部署到 Heroku 时未找到

ruby-on-rails - Rails 6 - 如何使用旧的 sprocket Assets 管道而不是 webpacker?

vim - Syntastic 和 Python 模式在一起?

javascript - 将 JQuery 对话框置于前面

css - 在 div 悬停时为 div 内的元素设置样式

vim - 在 Syntastic 中禁用 "Quickfix list"

css - OpenERP 字体系列 : 'Free 3 of 9' for barcode is not working in report webkit