2015-11-05 81 views
0

我試圖讓Bower在我的Drupal項目中工作。在我的項目的根目錄中,我有一個bower.json.bowerrc文件。 Bower組件正在安裝在sites/all/themes/mytheme/libraries使用grunt-wiredep後錯誤的涼亭組件路徑

我設置咕嚕-wiredep自動注入我的涼亭的部件在我html.tpl.php文件,像這樣:

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> 

我已經嘗試在wiredep任務中添加directory: 'sites/all/thems/mytheme';,但隨後出現我的依賴關係未安裝的錯誤。

任何人都可以幫助我嗎?

回答

0

看來我現在正在工作。下面是我所做的:

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}}"/>', 
       } 
      } 
     } 
    } 
}