简体   繁体   English

找不到导入的Sass文件或文件不可读,文件确实存在

[英]Sass file to import not found or unreadable, file does exist

I am writing a ruby script to compile SCSS in to CSS and it cannot seem to find the file that I am importing. 我正在编写一个ruby脚本将SCSS编译为CSS,但似乎找不到我要导入的文件。

Here is the my ruby script, pretty basic right now 这是我的ruby脚本,现在非常基本

require "sass"

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

puts template

options = {
  :syntax => :scss
}

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

puts render

Here is brand_oit_appdev.scss 这是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 */
}

Here is the error 这是错误

(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>'

Here is a screenshot of the src folder 这是src文件夹的屏幕截图

I am out of ideas on how to fix this. 我没有解决此问题的想法。 I have verified that the file is readable, because I am able to read it from a ruby command. 我已验证该文件可读,因为我能够从ruby命令读取它。

Can anyone help me? 谁能帮我?

You need to update the Sass::Engine options with load_paths. 您需要使用load_paths更新Sass :: Engine选项。 Example: 例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM