问题
This is driving me nuts - I have a Rails app built on Bootstrap. I have been plugging along for a few weeks and today I hit a very bizarre issue. If I make any trivial change (i.e. add a new line and save) to ANY style sheet I loose a bunch of my CSS formatting.
This is hard to explain without some how publishing all my code etc. The biggest symptom is the loss of my Google fonts.
Here is the top part of my application.css.scss file:
@import "font-awesome-sprockets";
@import "font-awesome";
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,300,600,700);
/*** BOOTSTRAP ***/
/* Needs to load first to overide the default CSS */
@import "bootstrap_custom";
@import "bootstrap-sprockets";
@import "bootstrap";
@import "timeline";
I have some more custom CSS after this too. The font-awesome and bootstrap CSS still seems to load. The CSS code that seems to disappear is the bootstrap_custom. This is where I have my Google fonts and some custom CSS for my nav-bar.
Restarting the rails server does not fix it. Replacing the edited css file does not work. I literally have to restore an older version of the entire app directory.
It does not matter if I change the file with terminal or TextMate - same result.
If it matters I am running Rails 4.1.8 on OS X 10.10.1. I must hame something configured wrong or there is some weird Rails server cache or setting I am missing here. The fact I have to restore the entire app directory would lead me to believe this.
UPDATE
I think its a SASS or Bootstrap-sass issue. I ran the CSS from both versions through an online file compare site. The working version has CSS comments like this:
/* line 111, /Users/dan/.rvm/gems/ruby-2.0.0-p247/gems/bootstrap-sass-3.3.1.0/assets/stylesheets/bootstrap/_carousel.scss */
.carousel-control.right {...
and the broken one:
/* line 5482, /Users/dan/Rails/broken-app/vendor/assets/stylesheets/bootstrap.css */
.carousel-control.right {...
The working one also has around 500 more lines of CSS! Again this was just after adding a line to my application.css.css file, deleting it and saving it again. Same result if you clear the cache. Will look at my gems versions etc.
来源:https://stackoverflow.com/questions/28061058/editing-my-sass-stylesheets-in-the-asset-pipeline-seems-to-break-the-asset-pipel