我已经编写了 grunt uncss 任务来删除我的代码中未使用的 css。但是它删除了我的代码中使用的大量 css。我猜原因是,它没有在指令中检查 css'my-directive'
这是我的 index.html:
<div>
<span class="duplicate-text" ng-if="duplicateMode" ng-bind-template="{{'html.peopleeditor.duplicate.label'|property}}"></span>
</div>
<div class="peopleeditor col-xs-10 col-sm-10 col-md-10 col-lg-10" id="peopleeditorcontainer">
<my-directive controller="actionframework.controller" options="options"/>
</div>
在我的 index.css 中,我有一些类,例如:
.peopleeditor .form-horizontal .control-label,
.peopleeditor .form-horizontal .radio,
.peopleeditor .form-horizontal .checkbox,
.peopleeditor .form-horizontal .radio-inline,
.peopleeditor .form-horizontal .checkbox-inline {
margin-bottom: 0;
margin-top: 0;
}
.duplicate-text {
font-family: 'Roboto-Bold', sans-serif;
font-size: 12px;
}
在运行 grunt uncss 任务时,许多带有 .peopleeditor 类的样式都被删除了。是不是因为peopleeditor
类会被应用到里面的html标签上'my-directive'
。有什么方法可以读取指令模板中的样式,以便 grunt uncss 任务不会忽略这一点。