Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after adding @import "bootstrap"; ArgumentError in Static_pages#home

I'm at 5.1.2 of the railstutorial, I have just installed Bootstrap-sass (I've double checked, the gem is there). http://ruby.railstutorial.org/chapters/filling-in-the-layout#top

I added this file: app/assets/stylesheets/custom.css.scss

And when I give it this content:

@import "bootstrap";

My http://localhost:3000/static_pages/home does not work anymore. It gives the following error:

ArgumentError in Static_pages#home

Showing c:/Sites/rails_projects/sample_app/app/views/layouts/application.html.erb where line #5 raised:

different prefix: "e:/" and "c:/Sites/rails_projects/sample_app/app/assets/stylesheets"
  (in c:/Sites/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss)
Extracted source (around line #5):

2: <html>
3:   <head>
4:     <title><%= full_title(yield(:title)) %></title>
5:     <%= stylesheet_link_tag    "application", :media => "all" %>
6:     <%= javascript_include_tag "application" %>
7:     <%= csrf_meta_tags %>
8:     <!--[if lt IE 9]>
Rails.root: c:/Sites/rails_projects/sample_app

Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___557356520_29974776'

Any help would be much appreciated, thanks!

like image 221
user2349461 Avatar asked Dec 28 '25 09:12

user2349461


1 Answers

Your gems is in E: while your app is in C:\

When trying to @import, Assets module will search several places including gem path. But it can't recognize the disk within the path. That's why your @import fails.

Suggestion: Put your app and gems in same disk.

Side note: Don't use Windows for Rails development at all.

like image 130
Billy Chan Avatar answered Dec 31 '25 00:12

Billy Chan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!