1. Summary
I can't set grunt-clean-console plugin, that it works for all my .html
files.
2. Details
grunt-clean-console check browser console errors for .html
files.
I want to check browser console errors for all .html
files of my site. In official descripition I read, how plugin works for specific values of url
key. I have many pages in my site; I don't want add each .html
file separately. But I can't find, how I can use patterns.
I find, that I can use patterns for built-in Grunt cwd
, src
, dest
keys. But how I can use glob (or another) patterns for custom keys as url
of this plugin?
3. Data
Gruntfile.coffee
:module.exports = (grunt) -> grunt.loadNpmTasks 'grunt-clean-console' grunt.initConfig 'clean-console': all: options: url: 'output/index.html' return
example project configuration:
output │ 404.html │ index.html │ ├───KiraFirstFolder │ KiraFirstfile.html │ └───KiraSecondFolder KiraSecondFile.html
If I set specific values for
url
key without patterns as in example above, grunt-clean-console successfully works: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. Steps to reproduce
I run in console:
grunt clean-console --verbose
4. Not helped
4.1. Globbing
Gruntfile.coffee
:module.exports = (grunt) -> grunt.loadNpmTasks 'grunt-clean-console' grunt.initConfig 'clean-console': all: options: url: 'output/**/*.html' return
output:
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. Building the object dinamically
Gruntfile.coffee
(example):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
output:
File: [no files] Options: urls=[], timeout=5, url=["output/**/*.html"] Fatal error: missing url
4.3. Templates
Gruntfile.coffee
:module.exports = (grunt) -> grunt.loadNpmTasks 'grunt-clean-console' grunt.initConfig 'clean-console': all: options: url: '<%= kiratemplate %>' kiratemplate: ['output/**/*.html'], return
output:
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.