gpt4 book ai didi

import - Rails4 : @import "my_folder" (with index. css.sass 在里面)不再工作,只有 @import "my_folder/index"可以

转载 作者:行者123 更新时间:2023-12-05 01:16:14 30 4
gpt4 key购买 nike

我们正在将 Rails 3.2 应用程序升级到 Rails 4.0。

我们有一个 assets/stylesheets/application/index.css.sass加载一些其他 sass 文件的文件,例如 assets/stylesheets/layout/index.css.sass文件。

在 Rails 3.2 中,它只需要做 @import "layout" ,但在 Rails 4.0 中,我们得到以下错误:

Sass::SyntaxError at /users/sign_in
File to import not found or unreadable: layout.
Load paths:
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
CompassRails::SpriteImporter
/Users/josh/Documents/Work/Sientia/iq/app/assets/fonts
/Users/josh/Documents/Work/Sientia/iq/app/assets/images
/Users/josh/Documents/Work/Sientia/iq/app/assets/javascripts
/Users/josh/Documents/Work/Sientia/iq/app/assets/stylesheets
/Users/josh/Documents/Work/Sientia/iq/vendor/assets/images
/Users/josh/Documents/Work/Sientia/iq/vendor/assets/javascripts
/Users/josh/Documents/Work/Sientia/iq/vendor/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/xray-rails-0.1.9/app/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/xray-rails-0.1.9/app/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/i18n-js-2.1.2/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/js-routes-0.9.6/app/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/bootstrap-datetimepicker-rails-0.0.11/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/bootstrap-datetimepicker-rails-0.0.11/vendor/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/jquery-ui-rails-2.0.2/vendor/assets/images
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/jquery-ui-rails-2.0.2/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/jquery-ui-rails-2.0.2/vendor/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/html5-rails-0.1.0/app/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/html5-rails-0.1.0/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/coffee-rails-4.0.1/lib/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/cocoon-1.2.1/app/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/select2-rails-3.5.0/app/assets/images
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/select2-rails-3.5.0/app/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/select2-rails-3.5.0/app/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/cleditor-rails-0.1.1/vendor/assets/images
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/cleditor-rails-0.1.1/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/cleditor-rails-0.1.1/vendor/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/fullcalendar-rails-1.6.4.0/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/fullcalendar-rails-1.6.4.0/vendor/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/rails3-jquery-autocomplete-1.0.12/lib/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/jquery-rails-2.1.3/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/twitter-bootstrap-rails-2.1.9/vendor/assets/fonts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/twitter-bootstrap-rails-2.1.9/vendor/assets/images
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/twitter-bootstrap-rails-2.1.9/vendor/assets/javascripts
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/twitter-bootstrap-rails-2.1.9/vendor/assets/stylesheets
/Users/josh/Documents/Work/Sientia/iq/app/assets/images/sprites
/Users/josh/Documents/Work/Sientia/iq/app/assets/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/compass-0.12.2/frameworks/blueprint/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/compass-0.12.2/frameworks/compass/stylesheets
/Users/josh/.rvm/gems/ruby-2.0.0-p247@iq/gems/compass-h5bp-0.1.2/stylesheets
Compass::SpriteImporter
(in /Users/josh/Documents/Work/Sientia/iq/app/assets/stylesheets/application/index.css.sass:80)

当明确做 @import "layout/index" , 有用。

我的问题:

1) 为什么 @import "layout"在 Rails 4.0 中不再工作了?

2) 所有这些在哪里做 CompassRails::SpriteImporter路径从何而来?他们还好吗,或者有什么问题吗?

最佳答案

您应该可以 @import 'layout/*'加载文件夹中的所有文件。

如果使用 config.assets.paths << "#{Gem.loaded_specs['gemname'].full_gem_path}/app/assets/stylesheets/gemname" 无法正确解析路径,您也可以手动配置一些路径。 .然后,您将能够从 Assets 管道中包含它们。

希望能帮助到你!

关于import - Rails4 : @import "my_folder" (with index. css.sass 在里面)不再工作,只有 @import "my_folder/index"可以,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21875554/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com