我正在尝试让Bower在我的Drupal项目中工作。在我的项目根目录中,我有一个bower.json和.bowerrc文件。sites/all/themes/mytheme/libraries中正在安装Bower组件。
wiredep: {
task: {
src: 'sites/all/themes/mytheme/templates/html.tpl.php'
}
}在使用grunt wiredep时,插件会将以下路径插入到我的index.tpl.php文件中:
<script src="../libraries/jquery/dist/jquery.js"></script>它应该是这样的:
<script src="sites/all/themes/mytheme/libraries/jquery/dist/jquery.js"></script>我尝试将directory: 'sites/all/thems/mytheme';添加到wiredep任务中,但随后收到错误消息,指出我的依赖项未安装。
有谁能帮我吗?
发布于 2015-11-05 23:12:05
看起来我现在把它弄好了。下面是我所做的:
1)我忽略了路径的第一部分:../
2)对于html文件,我替换了对js和css依赖项的引用。我将sites/all/themes/mytheme/添加到路径中。
下面是我的wiredep任务现在的样子:
wiredep: {
task: {
src: 'sites/all/themes/mytheme/templates/html.tpl.php',
ignorePath: '../',
fileTypes: {
html: {
replace: {
js: '<script src="sites/all/themes/mytheme/{{filePath}}"></script>',
css: '<link rel="stylesheet" href="sites/all/themes/mytheme/{{filePath}}"/>',
}
}
}
}
}https://stackoverflow.com/questions/33546810
复制相似问题