咕噜保持删除我的绝对路径 [英] Grunt keeps removing my absolute paths
问题描述
我在我的index.html像这样的一些外部JS文件的引用:
I have references to some external JS files in my index.html like this:
<!-- build:js(app) /scripts/vendor.js -->
<!-- bower:js -->
<script src="/bower_components/jquery/jquery.js"></script>
<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/jquery-ui/ui/jquery-ui.js"></script>
<!-- endbower -->
<!-- endbuild -->
我每次运行咕噜服务
(发电机角fullstack ),最初的斜线被删除(/ bower_components /...\"
→bower_components / ..
),这毁我的网页> 1步倒在层次结构。
Every time I run grunt serve
(generator-angular-fullstack), the initial slashes are removed ("/bower_components/..."
→ "bower_components/..."
), which ruins my pages >1 steps down in the hierarchy.
有速战速决?
推荐答案
从的https://github.com/stephenplusplus/grunt-bower-install/issues/43#issuecomment-33799772:
'bower-install': {
myTask: {
fileTypes: {
html: {
replace: {
js: '<script src="/{{filePath}}"></script>'
}
}
}
}
}
您将有可能以非并重新安装咕噜鲍尔安装使用这个新类型的配置。你也应该考虑使用 &LT;基本href =/方式&gt;
以及
You will likely have to un- and re-install grunt-bower-install to use this new type of configuration. You should also consider using <base href="/">
as well.
这篇关于咕噜保持删除我的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!