dotless css引用无法在发布模式下工作(使用Combress)

时间:2013-01-11 13:40:13

标签: dotless combres

我正在使用无网点的CSS。 这是我的代码

.jqmWindowBig
{
    width: 800px;
    height: 500px;
    margin-left: -400px;
    margin-top: -250px;
    .jqmWindowCommon;
}

.jqmWindowCommon {
    background-color: #EEE;
    color: #333;
    border: 1px solid black;
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    padding: 12px;
    overflow: auto;
}

当我在自己的机器上时,在调试模式下,所有css文件(也是这个main.less文件)都是单独引用的。

在这种情况下,jqmWindowBig类是jqmWindowBigjqmWindowCommon的组合,一切正常。

现在正在制作中,combress创建了我所有CSS文件的一个大文件,然后,CSS包含我在.LESS文件中输入的代码,因此.jqmWindowCommon部分不会被替换为'jqmWindowCommon'部分,jqmWindowBig不完整。

这是我的combress配置:

<resourceSets url="~/combres.axd"
                defaultDuration="30"
                defaultVersion="auto"
                defaultDebugEnabled="auto"
                defaultIgnorePipelineWhenDebug="true"
                localChangeMonitorInterval="30"
                remoteChangeMonitorInterval="60"
                >

    <resourceSet name="siteCss" type="css" >
      <resource path="~/Content/StyleSheet/start.css" />
      <resource path="~/Content/StyleSheet/Site.css" />
      <resource path="~/Content/StyleSheet/reset.css" />
      <resource path="~/Content/StyleSheet/screen.css" />
      <resource path="~/Content/StyleSheet/razortemplates.css" />
      <resource path="~/Content/StyleSheet/logonsmall.css" />
      <resource path="~/Content/StyleSheet/ui-lightness/jquery-ui-1.8.23.custom.css" />
      <resource path="~/Content/StyleSheet/MainLess.LESS" />
    </resourceSet>

简而言之:在发布模式下运行时,参考.jqmWindowCommon;不会被替换。

EDIT 不仅这不起作用,我可以看到这些规则

width: @planningEventItemWidth;

也不起作用,所以当与Combress&gt;结合使用时,基本没有.LESS功能正常工作

2 个答案:

答案 0 :(得分:1)

您的combres配置缺少LESS的过滤器:

<filters> 
  <filter type="Combres.Filters.DotLessCssFilter, Combres" />
</filters>

答案 1 :(得分:0)

如果您直接调出链接资源,您会发现它可能有错误。我不认为你可以在同一个resourceSet中添加css和更少的文件。

<强>更新 * 确认每个ResourceSet都有过滤器: * https://github.com/buunguyen/combres/issues/5#issuecomment-12915712

您可以使用无点过滤器将较少的文件移动到单独的资源集中,从而使其工作:

<filters>
  <filter type="Combres.Filters.DotLessCssCombineFilter, Combres" 
    acceptedResourceSets="siteLess"/>
</filters>
<resourceSet name="siteLess" type="css">
  <resource path="~/Content/StyleSheet/MainLess.LESS" />
</resourceSet>

希望有所帮助。