gpt4 book ai didi

css - 找不到或无法读取要导入的 Sass 文件,文件确实存在

转载 作者:行者123 更新时间:2023-11-28 04:39:06 24 4
gpt4 key购买 nike

我正在编写一个 ruby​​ 脚本来将 SCSS 编译成 CSS,但它似乎找不到我正在导入的文件。

这是我的 ruby​​ 脚本,现在非常基础

require "sass"

template = File.read("brand_oit_appdev.scss")

puts template

options = {
:syntax => :scss
}

render = Sass::Engine.new(template, options).render

puts render

这里是 brand_oit_appdev.scss

@import 'bootstrap_overrides';

header {
.navbar-header {
margin-left: 7px;

a.umn-homepage {
background-image: url(../images/revised-wordmark-transparent.png);
background-repeat: no-repeat;
margin-top: 4px;
margin-left: -10px;
height: 70px;
width: 305px;
display: block;

span {
visibility: hidden;
}
}
}

.global-links {
margin-top:5px;
font-weight: 200;
font-size: .9em;

ul {
margin-bottom: 0;
}

a {
color: $umn-white;
}
}

.search-form {
text-align: right;
margin-top: 4px;
margin-bottom: 0;
margin-right: -15px;

input {
width: 15em !important;
border-radius: 0 !important;
border: none;
transition: width .3s !important;

&:focus {
width: 21em !important;
}
}

button {
border: none;
background-color: inherit;
color: $umn-white;
font-weight: bold;

span {
font-size: 1.8em;
}

&:hover, &:focus {
color: $umn-white;
}
}
}

.navbar-brand {
img {
width: 32px;
display: block;
float: left;
margin-right: 14px;
}
}

.application-title {
font-weight: 900;
}
}

@media (-webkit-min-device-pixel-ratio: 2) {
/* Retina-specific stuff here */
.navbar-header {
a.umn-homepage {
background-image: url(../images/revised-wordmark-transparent@2x.png) !important;
background-size: 410px 159px !important;
}
}
}

h1.page-header {
font-weight: light;
}

.table-nonfluid {
width: auto !important;
}

@media (max-width: $screen-sm-min) {
.application-title {
font-size: $font-size-h3 !important;
}
}

html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 6em;
}
table {
.numeric {
text-align: right;
}
}
footer {
font-size: .9em;
position: absolute;
bottom: 0;
width: 100%;
height: 4.5em;
text-align: center;
}

blockquote footer{
position:relative;
height:inherit;
text-align:inherit;

}

.label-style{
/* mimics Bootstrap's label styling */
max-width:100%;
margin-bottom:5px;
font-weight:bold;
}


*:focus{

border-color: rgba(82,168,236,.8) !important;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important;
outline: 0 none !important;
outline: thin dotted \9; /* IE6-9 */
}

这里是错误

(sass):1: File to import not found or unreadable: bootstrap_overrides. (Sass::SyntaxError)
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/import_node.rb:67:in `rescue in import'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/import_node.rb:45:in `import'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/import_node.rb:28:in `imported_file'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/import_node.rb:37:in `css_import?'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:313:in `visit_import'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `block in with_base'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `with_base'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `map'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `visit_children'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:169:in `block in visit_children'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:168:in `visit_children'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `block in visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:188:in `visit_root'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:159:in `visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:8:in `visit'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/root_node.rb:36:in `css_tree'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/tree/root_node.rb:20:in `render'
from /home/jphamlett/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/sass-3.4.23/lib/sass/engine.rb:281:in `render'
from print-script.rb:11:in `<main>'

这里是src文件夹的截图

我不知道如何解决这个问题。我已经验证该文件是可读的,因为我可以通过 ruby​​ 命令读取它。

谁能帮帮我?

最佳答案

您需要使用 load_paths 更新 Sass::Engine 选项。示例:

options = {
:syntax => :scss,
:load_paths => [ './' ]
}

关于css - 找不到或无法读取要导入的 Sass 文件,文件确实存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41309323/

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