使用grunt更新基本href [英] Using grunt to update base href
本文介绍了使用grunt更新基本href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在有角度的应用程序的构建过程中,我想将<base href="/app-dev/">
标记更新为index.html
内部的<base href="/app/">
During the build process of an angular app, I would like to update the <base href="/app-dev/">
tag to <base href="/app/">
inside index.html
是否可以用usemin
更新此标签(目前,我使用它来更新js和css的链接)?如果没有,我应该使用什么艰巨的任务来做到这一点?
Is there a way to update this tag with usemin
(for now, I use it to update the links to the js and css)? If not, what grunt task should I use to do that?
推荐答案
我也像这样使用grunt-processhtml
I used grunt-processhtml too like so
在您说的index.html文件中
in your say index.html file
<!-- build:[href]:build /path/you/want/ -->
<base href="/~myusername/myapp/public/" />
<!-- /build -->
在您的Gruntfile.js文件中添加这样的任务配置
in your Gruntfile.js add a task config like so
processhtml: {
options: {
//
},
build: {
files: {
'dist/index.html':['public/index.html']
}
}
}
当然要安装npm软件包!
and install the npm package of course!
npm install grunt-processhtml --save-dev
这篇关于使用grunt更新基本href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文