Mixin using LESS

孤街浪徒 提交于 2019-12-08 08:52:36

问题


I'm reading the LESS official documentation (version 1.5) but I cannot understand how to import a reference to another CSS in order to use its content in my own file. For example:

mystyle.less

@import (reference) "bootstrap.min.css";
.mylabel {
    .label-success;
}

It shows this error: NameError: .label-success is undefined

Perhaps I misunderstand the documentation?


回答1:


You can only use reference with other LESS files. You cannot mix and match LESS and CSS files with that method.

If you need to use the mixins from Bootstrap, grab the Bootstrap LESS files.

Update: You can also specify the reference type, which should work for what you need:

@import (reference, less) "bootstrap.min.css";


来源:https://stackoverflow.com/questions/20244996/mixin-using-less

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!