我试图在 rails 项目中使用我的第一个 css gem 我收到错误
im trying to use my first css gem in rails project im getting an error
我试图在 rails 项目中使用我的 scss gem,但是一旦我安装了 gem,我就会收到以下错误消息:
file to import not found.
这是我的gem规格代码
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
我不知道我的 gem 或它的 gem 规格有什么问题。
源代码可在我的 github 个人资料 https://github.com/tongoonamujera/scss_ninja.git
中找到
您似乎没有将 lib
目录发送到 gem 目录中:
spec.files = Dir['app/**/*']
并且当 Bundler 试图请求主 gem 文件 (lib/scss_ninja.rb
) 时,它不存在。获取安装的gem目录的路径:
gem info scss_ninja
并检查 gem 安装了哪些文件。如果 lib
目录不存在,宾果游戏。
您可以像这样包含更多文件:
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
同时查看 gem 指南中的 spec.files
方法 description。
我试图在 rails 项目中使用我的 scss gem,但是一旦我安装了 gem,我就会收到以下错误消息:
file to import not found.
这是我的gem规格代码
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
我不知道我的 gem 或它的 gem 规格有什么问题。
源代码可在我的 github 个人资料 https://github.com/tongoonamujera/scss_ninja.git
您似乎没有将 lib
目录发送到 gem 目录中:
spec.files = Dir['app/**/*']
并且当 Bundler 试图请求主 gem 文件 (lib/scss_ninja.rb
) 时,它不存在。获取安装的gem目录的路径:
gem info scss_ninja
并检查 gem 安装了哪些文件。如果 lib
目录不存在,宾果游戏。
您可以像这样包含更多文件:
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
同时查看 gem 指南中的 spec.files
方法 description。