1。总结
我不能设定
grunt-clean-console
插件,它适用于所有我的
.html
文件夹。
2。细节
Grunt Clean控制台检查浏览器控制台错误
HTML
文件夹。
我想检查所有浏览器控制台错误
HTML
我网站的文件。
In official descripition
我读到了,插件是如何为特定值工作的
url
关键。我的网站上有很多页面,我不想每一页都添加
HTML
单独归档。但我找不到如何使用模式。
我发现,我可以使用模式来内置呼噜声
cwd
,
src
,
dest
钥匙。但我如何使用glob(或其他)模式作为自定义密钥
网址
这个插件?
三。数据
-
Gruntfile.coffee
:
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-clean-console'
grunt.initConfig
'clean-console':
all:
options:
url: 'output/index.html'
return
-
例子
项目配置:
output
â 404.html
â index.html
â
ââââKiraFirstFolder
â KiraFirstfile.html
â
ââââKiraSecondFolder
KiraSecondFile.html
-
如果我为
网址
没有模式的键,如上例所示,Grunt Clean控制台成功工作:
phantomjs: opening page output/index.html
phantomjs: Checking errors after sleeping for 5000ms
ok output/index.html
phantomjs process exited with code 0
Done.
3.1。复制的步骤
我在控制台中运行:
grunt clean-console --verbose
4。没有帮助
4.1。文件名代换
-
Official documentation
-
Gruntfile.coffee咖啡
:
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-clean-console'
grunt.initConfig
'clean-console':
all:
options:
url: 'output/**/*.html'
return
-
输出:
phantomjs: opening page http://output/**/*.html
phantomjs: Unable to load resource (#1URL:http://output/**/*.html)
phantomjs: phantomjs://code/runner.js:30 in onResourceError
Error code: 3. Description: Host output not found
phantomjs://code/runner.js:31 in onResourceError
phantomjs: loading page http://output/**/*.html status fail
phantomjs://code/runner.js:50
phantomjs process exited with code 1
url output/**/*.html has 1 error(s)
>> one of the urls failed clean-console check
Warning: Task "clean-console:all" failed. Use --force to continue.
Aborted due to warnings.
4.2。以常规方式构建对象
-
Official documentation
-
Gruntfile.coffee咖啡
(例):
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-clean-console'
grunt.initConfig
'clean-console':
all:
options:
url:
files: [
expand: true
cwd: "output/"
src: ['**/*.html']
dest: "output/"
]
return
-
输出:
File: [no files]
Options: urls=[], timeout=5, url=["output/**/*.html"]
Fatal error: missing url
4.3。模板
-
Official documentation
-
Gruntfile.coffee咖啡
:
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-clean-console'
grunt.initConfig
'clean-console':
all:
options:
url: '<%= kiratemplate %>'
kiratemplate: ['output/**/*.html'],
return
-
输出:
phantomjs: opening page http://output/**/*.html
phantomjs: Unable to load resource (#1URL:http://output/**/*.html)
phantomjs: phantomjs://code/runner.js:30 in onResourceError
Error code: 3. Description: Host output not found
phantomjs://code/runner.js:31 in onResourceError
loading page http://output/**/*.html status fail
phantomjs://code/runner.js:50
phantomjs process exited with code 1
url output/**/*.html has 1 error(s)
>> one of the urls failed clean-console check
Warning: Task "clean-console:all" failed. Use --force to continue.
Aborted due to warnings.