gpt4 book ai didi

css - 使用 ant 替换 css 的多个可变内容行

转载 作者:行者123 更新时间:2023-11-28 18:56:34 25 4
gpt4 key购买 nike

我有一个带有可变部分的 css 文件,我想在运行构建脚本时从文件中删除该部分(但我需要将该部分保留在源代码中)。我在想我会用某种标记将注释部分 (/* remove-front /&/ remove-back */) 包装起来,然后使用 ant 将注释之间的所有内容替换为什么都没有。

这是我的例子:

/* remove-front */
.footerGradients {
/* gradient settings (used http://www.colorzilla.com/gradient-editor/ to generate following code) */

background-color: #606869;
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #2f3838), color-stop(100%, #606869));
background: -moz-linear-gradient(center bottom, #2f3838 0, #606869 100%);
background: -ms-linear-gradient(center bottom, #2f3838 0, #606869 100%);
background: -o-linear-gradient(center bottom, #2f3838 0, #606869 100%);
background: linear-gradient(center bottom, #2f3838 0, #606869 100%);
-pie-background: linear-gradient(#2f3838, #606869);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#2f3838,endColorstr=#606869);
/* end gradient settings */

}
.footerShadows {
/* box shadow settings (used http://css3generator.com/ to generate following code) */

-webkit-box-shadow: 0 0 2px 0 #293535;
-moz-box-shadow: 0 0 2px 0 #293535;
box-shadow: 0 0 2px 0 #293535;
/* end box shadow settings */

}
/* remove-back */

预先感谢您的回复。

最佳答案

我和@FailedDev 有同样的想法,但是在尝试我的 Eclipse 时,它​​对“m”选项犹豫不决(我已经添加了使用 /*remove-front */(空格)和 /*REMOVE-BACK*/(不区分大小写):

<copy tofile="src/test2.css" file="src/test.css" overwrite="true"/>
<replaceregexp
file="src/test2.css"
match="/\*\s*remove-front\s*\*/.*?/\*\s*remove-back\s*\*/"
replace=""
flags="gsi"
byline="false"/>

关于css - 使用 ant 替换 css 的多个可变内容行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7668486/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com