gpt4 book ai didi

javascript - Grunt 一直在删除我的绝对路径

转载 作者:行者123 更新时间:2023-12-03 12:48:33 26 4
gpt4 key购买 nike

我在 index.html 中引用了一些外部 JS 文件,如下所示:

<!-- 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 -->

每次我运行 grunt serve ( generator-angular-fullstack ) 时,初始斜杠都会被删除 ("/bower_components/...""bower_components/..."),这破坏了我的页面 >1 层级中的步骤。

有快速修复方法吗?

最佳答案

来自 https://github.com/stephenplusplus/grunt-bower-install/issues/43#issuecomment-33799772 :

'bower-install': {
myTask: {
fileTypes: {
html: {
replace: {
js: '<script src="/{{filePath}}"></script>'
}
}
}
}
}

您可能需要卸载并重新安装 grunt-bower-install 才能使用这种新型配置。您还应该考虑使用 <base href="/">

关于javascript - Grunt 一直在删除我的绝对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21722097/

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