如何在 Rails 3.1 Asset Pipeline 中使用 less 中的变量
我正在将一些 less 文件转换为 Rails 应用程序,并在处理变量和其他 less 功能时遇到问题。
我需要 application.css 中的资产,但是在查看页面时看到以下错误:
Less::ParseError: variable @light-border is undefined
(in tokens.css.less
Served asset /tokens.css - 500 Internal Server Error
我有一个定义所有变量的 less 文件和定义各种 mixins 的其他几个文件。
这个问题似乎也影响了混合 - 看起来更少的文件是单独处理的,但不是作为单个上下文......因此变量和混合错误。将渲染单个文件,但不包括各种组件和变量。
有什么技巧可以让它在 Rails 中工作吗?
I am converting a number of less files into a rails app, and running into problems with the processing of variables and other less features.
I require my assets in application.css, but when viewing the page see the following error:
Less::ParseError: variable @light-border is undefined
(in tokens.css.less
Served asset /tokens.css - 500 Internal Server Error
I have a less file that defines all my variables and several other files that define various mixins.
The problem also seems to affect the mixins - looks like the less files are being processed individually, but not as a single context ... hence the variable and mixin errors. Individual files will render, but not include the various components and variables.
Is there a trick to getting this working in Rails?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我添加了 less-rails gem,它现在似乎可以工作了。我认为资产管道实际上只支持基本的较少使用。
I added the less-rails gem and it seems to work now. I think the asset pipeline doesn't actually support more than rudimentary less use.