2016-11-12 15 views
-3

我得到這個錯誤,而在我的Rails應用程序添加一個自舉模板:模板::錯誤(未定義混入 '邊界半徑'。):

ActionView::Template::Error (Undefined mixin 'border-radius'.): 
    2: <html> 
    3: <head> 
    4: <title>Zunosys</title> 
    5:  <%= stylesheet_link_tag 'application', media: 'all', 'data-turboli 
nks-track' => true %> 
    6: <%= javascript_include_tag 'application', 'data-turbolinks-track' => tr 
ue %> 
    7: <%= csrf_meta_tags %> 
    8: </head> 
    app/assets/stylesheets/_accordion.scss:6:in `border-radius' 
    app/assets/stylesheets/_accordion.scss:6 
    app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_ht 
ml_erb___752436248_72006156' 

我application.css.sass

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 
* 
* You're free to add application-wide styles to this file and they'll appear at the bottom of the 
* compiled file so the styles you add here take precedence over styles defined in any styles 
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new 
* file per style scope. 
* 
*= require_tree . 
*= require_self 
*/ 

@import "bootstrap-sprockets" 
@import "bootstrap" 

我application.html.erb

<!DOCTYPE html> 
<html> 
<head> 
    <title>Zunosys</title> 
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 
    <%= csrf_meta_tags %> 
</head> 
<body> 

<%= yield %> 

</body> 
</html> 

我accordion.scss

/* Accordion 
----------------------------------------------------------*/ 

.panel-group .panel { 
    @include border-radius(0); 
} 

.panel { 
    @include box-shadow(none); 
} 

.panel-heading { 
    @include border-radius(0); 
} 

.panel-default { 
    .panel-heading { 
     background-color: $color-grey; 
    } 
} 

.panel-group { 
    .panel-2 { 
     background: transparent; 

     .panel-heading { 
      padding: 18px 0px 18px 45px; 
      border-bottom: 1px solid $color-line-dark; 

      .panel-title { 
       position: relative; 
       font-size: 20px; 

       > a { 
        &:before { 
         position: absolute; 
         top: 0; 
         left: -40px; 
         width: 24px; 
         height: 24px; 
         content: ' '; 
         @include border-radius(50%); 
         background: $color-grey-3; 
         color: #fff; 
         font-family:'FontAwesome'; 
         font-size: 14px; 
         text-align: center; 
         padding: 5px; 
         content:"\f068"; 
        } 
        &[aria-expanded="false"]:before { 
         content: "\f067"; 
        } 
       } 
      } 
     } 
     .panel-body { 
      border-top: none !important; 
      padding: 18px 0px 18px 45px; 
     } 

     & + .panel-2 { 
      margin-top: 0; 
     } 
    } 
} 

html[dir="rtl"] { 
    .panel-group { 
     .panel-2 { 
      .panel-heading { 
       padding: 18px 45px 18px 0; 
       .panel-title { 
        > a { 
         &:before { 
          right: -40px; 
          left: auto; 
         } 
        } 
       } 
      } 
      .panel-body { 
       padding: 18px 45px 18px 0; 
      } 
     } 
    } 
} 

我的Gemfile

source 'http://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.7' 
# Use sqlite3 as the database for Active Record 
group :development, :test do 
    gem 'sqlite3' 
end 

group :production do 
    gem 'pg' 
end 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 

gem 'bootstrap-sass', '~> 3.2.0' 
gem 'autoprefixer-rails' 
gem 'compass' 

# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

我以前用過這個主題我的其他Rails項目和它工作得很好。

+0

那麼你得到可能是因爲你還沒有宣佈混入的錯誤。 – David

+0

[首次推送到heroku時出現意外標記錯誤]的可能重複(http://stackoverflow.com/questions/40551339/unexpected-token-error-while-pushing-to-heroku-for-the-first-時間) –

回答

1

我以前沒有使用過mixins,但看起來像@ hanners66是正確的(因爲你沒有在這裏顯示該聲明)。你需要聲明它。如果妳會嘗試谷歌「混入」你會發現這一點:

http://sass-lang.com/guide

@mixin border-radius($radius) { 
    -webkit-border-radius: $radius; 
    -moz-border-radius: $radius; 
     -ms-border-radius: $radius; 
      border-radius: $radius; 
} 

.box { @include border-radius(10px); }