I'm trying to use Rails Asset Pipeline to work with a less.erb file.
Before I used LESS, I used SCSS. With SCSS I could have SCSS.ERB files. Everything worked perfectly.
Unfortanately, the UI Framework that I want to use (Semantic-UI) doesn't support SCSS, only LESS.
So I changed:
Added these gems:
gem 'less-rails', '~> 2.7.0'
gem 'therubyracer', '~> 0.12.2'
gem 'less-rails-semantic_ui', '~> 2.0.7'
Then I add _colors.less.erb file to my asset pipeline (in assets/stylesheets/core/_colors.less.erb), with this content:
@import "variables/_colors.less";
<% colors_list = %w(primary secondary gray green red blue yellow purple orange brown violet pink olive teal) %>
/*--------------------
Background Colors
---------------------*/
<% colors_list.each do |color| %>
.bg-color-<%=color%> { background-color: @color-<%=color%>; }
.bg-color-<%=color%>-darker { background-color: @color-<%=color%>-darker; }
.bg-color-<%=color%>-dark { background-color: @color-<%=color%>-dark; }
.bg-color-<%=color%>-light { background-color: @color-<%=color%>-light; }
.bg-color-<%=color%>-lighter { background-color: @color-<%=color%>-lighter; }
<% end %>
.bg-color-black { background-color: @color-black; }
.bg-color-white { background-color: @color-white; }
.bg-color-gray-darkest { background-color: @color-gray-darkest; }
.bg-color-gray-lightest { background-color: @color-gray-lightest; }
The problem here is that, unlike scss.erb files, these less.erb files are not precompiled from erb to less.
It returns the error: 'core/_colors.less' wasn't found
Does anyone know why this happens?
答案 0 :(得分:0)
我不确定,但你说“_colors.less”在“assets / stylesheets / core / _colors.less.erb”中,你从“variables / _colors.less”导入
我认为你的导入应该是“core / _colors.less”