我正在尝试将wiredep与我的项目连接,但没有成功。我在assets /中有bower_components和bower.json,在根目录中有gruntfile.js。这是相关的gruntfile:
wiredep: {
target: {
src: [
'grunt-test.html',
'application/views/inc/inc_scripts.php',
'application/views/inc/inc_head.php'
],
directory: 'assets/bower_components',
bowerJson: 'assets/bower.json',
fileTypes: {
php: {
block: /(([\s\t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
detect: {
js: /<script.*src=['"](.+)['"]>/gi,
css: /<link.*href=['"](.+)['"]/gi
},
replace: {
js: '<script src="{{filePath}}"></script>', // <-- Change this line
css: '<link rel="stylesheet" href="{{filePath}}" />'
}
},
html: {
block: /(([\s\t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
detect: {
js: /<script.*src=['"](.+)['"]>/gi,
css: /<link.*href=['"](.+)['"]/gi
},
replace: {
js: '<script src="{{filePath}}"></script>', // <-- Change this line
css: '<link rel="stylesheet" href="{{filePath}}" />'
}
}
}
}
}
然后我运行grunt wiredep --verbose
并获得以下输出:
Running "wiredep" task
Running "wiredep:target" (wiredep) task
Verifying property wiredep.target exists in config...OK
Files: grunt-test.html, application/views/inc/inc_scripts.php, application/views
/inc/inc_head.php
Verifying property wiredep.target.src exists in config...OK
Options: src=["grunt-test.html","application/views/inc/inc_scripts.php","application/views/inc/inc_head.php"], directory="assets/bower_components", bowerJson="a ssets/bower.json",fileTypes={"php":{"block":{},"detect":{"js":{},"css":{}},"replace":{"js":"<script src=\"{{filePath}}\"></script>","css":"<link rel=\"stylesheet\" href=\"{{filePath}}\" />"}},"html":{"block":{},"detect":{"js":{},"css":{}},"replace":{"js":"<script src=\"{{filePath}}\"></script>","css":"<link rel=\"stylesheet\" href=\"{{filePath}}\" />"}}}
Done, without errors.
但没有任何反应。我已经确定我正在使用正确的标签,甚至尝试添加HTML文件(grunt-test.html)以确保它不是文件类型的东西,但我现在不知所措。
你们看到了什么?
提前致谢。