English 中文(简体)
没有风格的进口规则减少
原标题:less css import rules without styles

我有var。

@base: #96959A;
.ts_no{ text-shadow: none; }
.pos { position: absolute; z-index: 2; display: block; }

............

Compiled vars.cs:

.ts_no {
  text-shadow: none;
}
.pos {
  position: absolute;
  z-index: 2;
  display: block;
}

我的档案少有几处,其中包括无案(@import vars)。 因此,所有这些档案都无所作为。 因此,所有汇编的目录都包含汇编的词汇。 档案风格较差:

风格:

.ts_no { text-shadow: none; }
.pos { position: absolute; z-index: 2; display: block; }

............

What is the best way to have variables and mixins in one file, and not repeat it in all files?

感谢

最佳回答

或许最简单的办法是把你的组合定义为paramet的组合,类似于其他语文的“功能”。 当然,通常的参数是参数,但如果你不需要接受任何参数,你就可以简单地排除这些参数,使用空洞的母体。

这意味着重写<代码>vars.less。 类似档案:

@base: #96959A;
.ts_no() { text-shadow: none; }
.pos() { position: absolute; z-index: 2; display: block; }

如果在另一条规则中没有明确使用标准,这将防止规则出现在你汇编的中央支助事务产出中。

documentation 提供更多详情。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签