gpt4 book ai didi

html - 通过 git post-receive 将 styles.less 替换为 styles.css

转载 作者:太空狗 更新时间:2023-10-29 14:15:59 25 4
gpt4 key购买 nike

我有一个带有 index.html 的本地开发网站,它正在使用:

<!-- LESS -->
<link rel="stylesheet/less" type="text/css" href="css/styles.less" />
<script src="js/lib/less-1.1.3.min.js" type="text/javascript"></script>

当我准备好编辑时,我提交/推送到我的开发服务器,git post-receive Hook 运行我的 build.sh 并构建我的 css/requireJS/smartsprites 应用程序。

如何将静态 HTML 文件中的上述代码替换为:

<link rel="stylesheet" type="text/css" href="css/styles.css" />

无需切换到服务器端脚本(PHP/等)或动态 node.js css 渲染。

在我的 build.sh 脚本中?用正则表达式?如何?举个例子就好了。

最佳答案

你可以只使用sed:

sed -i -e 's/styles\.less/styles\.css/g' index.html

我还没有使用过 git-post-receive(我什至不知道它存在!谢谢 :P),但你可以把它推到你的 build.sh 文件或将文件推送到服务器时运行的任何文件。

关于html - 通过 git post-receive 将 styles.less 替换为 styles.css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7585974/

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