我一直在尝试使用 http://startbootstrap.com/stylish-portfolio,下载所有文件并复制到目录后,我在部分_bordered拉取时收到以下错误:
ActionView::Template::Error (Undefined variable: "$fa-css-prefix".
但是,变量已定义,我正在导入(或至少尝试)部分变量。
我的资产/样式表目录如下:
--application.css.scss
--bootstrap.css.scss
--font-awesome.css.scss.erb
--stylish-portfolio.css.scss
--|font-awesome
--_bordered-pulled.css.scss
--...(other partials)
--font-awesome.css.scss
应用程序.css.scss:
/*
* 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
@import 'font-awesome/font-awesome';
@import 'bootstrap';
@import 'font-awesome';
@import 'stylish-portfolio';
Font-awesome.css.scss
/*!
* Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@import "variables";
@import "mixins";
@import "path";
@import "core";
@import "larger";
@import "fixed-width";
@import "list";
@import "bordered-pulled";
@import "spinning";
@import "rotated-flipped";
@import "stacked";
@import "icons";
_bordered拉.css.scss
// Bordered & Pulled
// -------------------------
.#{$fa-css-prefix}-border {
padding: .2em .25em .15em;
border: solid .08em $fa-border-color;
border-radius: .1em;
}
.pull-right { float: right; }
.pull-left { float: left; }
.#{$fa-css-prefix} {
&.pull-left { margin-right: .3em; }
&.pull-right { margin-left: .3em; }
}
是语法错误还是我设置了错误的资产管道?
_variable.css.scsshttps://github.com/IronSummitMedia/startbootstrap/blob/master/templates/stylish-portfolio/font-awesome/scss/_variables.scss
您必须执行以下操作:
打开项目的 font-awesome/less/variables.less 或 font-awesome/scss/_variables.scss,然后编辑 @fa-font-path 或 $fa-font-path 变量以指向您的字体目录。
资料来源:方塔索姆文献
http://fontawesome.io/get-started#custom-less
尝试检查如何预编译资源。检查初始值设定项/assets.rb(或者可能是 environment/production.rb),以确保以友好的方式预编译资产,如下所示:
config.assets.precompile += ["*.js", "*.scss", "*.jpg", "*.png"]
当它出现时,我遇到了同样的错误
config.assets.precompile += [/.*.png/,/.*.ico/,/.*.jpg/,/.*.js/,/.*.scss/]