Rails Asset Pipeline with sass @imports -
this question has answer here:
- import regular css file in scss file? 14 answers
i'm using rails 4.2.
in rails project directory, have 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 have directory period in it, have tried changing directory name , corresponding @import statement , didn't make difference)
i have added config.assets.paths << rails.root.join("frontend","styles")
application.rb
.
in /railsproject/app/assets/stylesheets/application.css
:
@import "main.scss";
everything far, loads/processes main.scss file.
in /railsproject/frontend/styles/main.scss
@import 'variables'; // works fine @import '../node_modules/normalize.css/normalize.css'; // not work
the second import doesn't work...i get error in chrome console, , rails server says:
started "/node_modules/normalize.css/normalize.css" ::1 @ 2015-07-02 15:55:38 +0800 actioncontroller::routingerror (no route matches [get] "/node_modules/normalize.css/normalize.css"):
what doing wrong?
sass not letting import css files, wants scss files compile css. either switch file extension scss or upgrade sass 3.2.10 supposed let import css files.
reference: import regular css file in scss file?
Comments
Post a Comment