如何在全息图源中引用外部依赖项(宝石)?

How can I reference external dependencies (gems) in hologram source?

我们正在使用全息图来创建我们的风格指南。 我们将一些已记录的样式移至外部 gem,以便与不同的项目共享它们。现在我们很难获得样式指南来查看 gem 中的 scss 文件。 在我们的全息图 yml 配置中,我们的源代码如下所示。我们怎样才能让它真正引用 gem 而不是硬编码路径?

source:
  - ./app/assets
  - ./public/styleguideforlovelydesigners/
  # TODO: this should use the actual GEM_PATH
  - ../our_gem/app/assets/stylesheets/shared_components

您可以将 gem 打包到您的 vendor 目录中;并使用该路径。另一种方法是将 gem 的完整路径插入 yaml 文件:

source:
  - ./app/assets
  - ./public/styleguideforlovelydesigners/
  # TODO: this should use the actual GEM_PATH
  - <%= Gem.loaded_specs['our_gem'].full_gem_path %>/app/assets/stylesheets/shared_components