Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
735 views
in Technique[技术] by (71.8m points)

css - Asset Pipeline Undefined Variable SASS

I've been trying to use http://startbootstrap.com/stylish-portfolio and after downloading all files and copying to the directory I'm getting the following error on the partial _bordered-pull:

ActionView::Template::Error (Undefined variable: "$fa-css-prefix".

However the variable is defined and I'm importing (or at least trying) the partial.

My assets/stylesheets directory is the following:

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

Application.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-pulled.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; }
}

Is it a syntax error or did I setup my asset pipeline wrong?

_variable.css.scss https://github.com/IronSummitMedia/startbootstrap/blob/master/templates/stylish-portfolio/font-awesome/scss/_variables.scss

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to do the following:

Open your project's font-awesome/less/variables.less or font-awesome/scss/_variables.scss and edit the @fa-font-path or $fa-font-path variable to point to your font directory.

Source: fontawsome's documentation

http://fontawesome.io/get-started#custom-less


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...