我们有一个使用 Grunt 和 Bundler 设置的项目。所有这些都安装没有问题。生成 Gemfile.lock,提取正确的 gems,并使用 npm 创建 grunt 文件。我们开始监视该项目,它在 sass 编译时爆炸,因为它使用了错误版本的 sass 而不是 gemfile 中指定的版本。
顺便说一下,这是在 Windows 上...
gem 文件
source 'https://rubygems.org'
gem 'sass', '~> 3.2'
gem 'compass', '~> 0.12'
gem 'susy', '~> 1.0'
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.3.1)
compass (0.12.6)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.2.19)
fssm (0.2.10)
sass (3.2.19)
susy (1.0.9)
compass (>= 0.12.2)
sass (>= 3.2.0)
PLATFORMS
x86-mingw32
DEPENDENCIES
compass (~> 0.12)
sass (~> 3.2)
susy (~> 1.0)
最佳答案
如果你想将你的 gem 限制为你的包中的那些(在你的 Gemfile 中列出),你应该在终端中运行它们时在你的命令前加上 bundle exec
。
例如。如果您正在运行 sass --watch
,那么您将运行 bundle exec sass --watch
以确保您使用的是包中的版本。
关于 bundle exec
的文档:http://bundler.io/man/bundle-exec.1.html
关于ruby - Grunt/Bundler 不会使用指定的 sass 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23388261/