Mixin using LESS

2019-06-06 08:50发布

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条回答
乱世女痞
2楼-- · 2019-06-06 09:04

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";
查看更多
登录 后发表回答