首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我试图在rails项目im中使用我的第一个css,得到一个错误

我试图在rails项目im中使用我的第一个css,得到一个错误
EN

Stack Overflow用户
提问于 2021-11-10 08:46:20
回答 1查看 45关注 0票数 0

我试图在rails项目中使用我的scss,但是一旦我安装了gem,我就会得到以下错误:

文件导入未找到。

这是我的gemspec代码

代码语言:javascript
复制
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require_relative "lib/scss_ninja/version"

Gem::Specification.new do |spec|
  spec.name          = "scss_ninja"
  spec.version       = ScssNinja::VERSION
  spec.authors       = ["tongoonamujera"]

  spec.summary       = "built to make styling look so easy"
  spec.description   = "Work still in progress"
  spec.homepage      = "https://github.com/tongoonamujera/scss_ninja.git"
  spec.license       = "MIT"
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")

  # spec.metadata["allowed_push_host"] = "https://github.com/tongoonamujera/scss_ninja.git"

  spec.metadata["homepage_uri"] = spec.homepage
  spec.metadata["source_code_uri"] = "https://github.com/tongoonamujera/scss_ninja.git"
  spec.metadata["changelog_uri"] = "https://tongoonamujera.github.io/scss_ninja/CHANGELOG.md"

  # Specify which files should be added to the gem when it is released.
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
  # spec.files = Dir.chdir(File.expand_path(__dir__)) do
  #   `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
  # end
  spec.files = Dir['app/**/*']
  spec.bindir        = "exe"
  spec.executables   = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
  spec.require_paths = ["lib"]

  # Uncomment to register a new dependency of your gem
  # spec.add_dependency "example-gem", "~> 1.0"

  # For more information and examples about making a new gem, checkout our
  # guide at: https://bundler.io/guides/creating_gem.html
  spec.add_runtime_dependency 'autoprefixer-rails', '~> 10.3', '>= 10.3.3.0'
  spec.add_runtime_dependency 'sassc', '~> 2.0'
end

我不知道我的宝石有什么问题,或者是宝石。源代码在我的github配置文件https://github.com/tongoonamujera/scss_ninja.git中找到

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-10 19:39:27

似乎您没有将您的lib目录传送到gem内容:

代码语言:javascript
复制
spec.files = Dir['app/**/*']

当邦德勒试图要求主创业板文件(lib/scss_ninja.rb)时,它并不存在。获取已安装的gem目录的路径:

代码语言:javascript
复制
gem info scss_ninja

并检查gem安装了哪些文件。如果lib目录不存在,则为bingo。

您可以包含更多这样的文件:

代码语言:javascript
复制
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]

还可以检查gem指南中的spec.files方法描述

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69910148

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档