I'm using Rails 4.2.
In my rails project directory, I have a frontend directory:
/railsproject/frontend
/railsproject/frontend/styles
/railsproject/frontend/styles/main.scss
/railsproject/frontend/styles/variables.scss
/railsproject/frontend/node_modules/normalize.css/
/railsproject/frontend/node_modules/normalize.css/normalize.css
(I know it's unusual to have a directory with a period in it, but I have tried changing the directory name and corresponding @import statement and it didn't make a difference)
I have added config.assets.paths << Rails.root.join("frontend","styles")
to application.rb
.
In /railsproject/app/assets/stylesheets/application.css
:
@import "main.scss";
Everything is good so far, it loads/processes the main.scss file.
In /railsproject/frontend/styles/main.scss
@import 'variables'; // this works fine
@import '../node_modules/normalize.css/normalize.css'; // this does NOT work
The second import doesn't work...I get a GET error in the Chrome console, and the rails server says:
Started GET "/node_modules/normalize.css/normalize.css" for ::1 at 2015-07-02 15:55:38 +0800
ActionController::RoutingError (No route matches [GET] "/node_modules/normalize.css/normalize.css"):
What am I doing wrong?