Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Grunt wiredep完成时没有错误,但没有';t注入依赖项_Php_Gruntjs_Wiredep - Fatal编程技术网

Php Grunt wiredep完成时没有错误,但没有';t注入依赖项

Php Grunt wiredep完成时没有错误,但没有';t注入依赖项,php,gruntjs,wiredep,Php,Gruntjs,Wiredep,我试图将wiredep与我的项目联系起来,但没有成功。我在assets/中有bower_组件和bower.json,在根目录中有gruntfile.js。以下是相关的Grunfile文件: wiredep: { target: { src: [ 'grunt-test.html', 'application/views/inc/inc_scripts.php', 'application/views/

我试图将wiredep与我的项目联系起来,但没有成功。我在assets/中有bower_组件和bower.json,在根目录中有gruntfile.js。以下是相关的Grunfile文件:

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}}" />'
                }
            }
        }
    }
}
但什么也没发生。我已经确保使用了正确的标记,甚至尝试添加一个HTML文件(grunt test.HTML),以确保它不是一个文件类型,但我现在不知所措

你们看到了什么


提前感谢。

它看起来与src文件匹配,因此它不能与src文件中的bower注释匹配(假设bower组件没有任何更改)。如果您共享一个php文件以供参考,可能会有所帮助?最后,问题与bower_组件与Grunfile.js不在同一文件夹中有关。当我将两者放在同一个文件夹中时,它工作了。它看起来与src文件相匹配,因此它不能与src文件中的bower注释相匹配(假设bower组件没有任何更改)。如果您共享一个php文件以供参考,可能会有所帮助?最后,问题与bower_组件与Grunfile.js不在同一文件夹中有关。当我把两者放在同一个文件夹中时,它起了作用。
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.