-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading "html_validation.js" tasks...ERROR and exit.... #74
Loading "html_validation.js" tasks...ERROR and exit.... #74
Comments
Same issue here for https://github.com/mryvlin/grunt-w3c-validation. It's because of the 'use strict' in file html_validation.js in combination with the the first line of function getValidate. In strict mode, you are not allowed to overwrite a function name. 'use strict';
module.exports = function (grunt) {
...
var htmlValidation = 'html-validation';
var cssValidation = 'css-validation';
...
var validate = function() {
...
}
...
function getValidate(validationType){
validate.name = validationType;
return validate;
}
grunt.registerMultiTask(htmlValidation, 'HTML W3C validation.', getValidate(htmlValidation));
grunt.registerMultiTask(cssValidation, 'CSS W3C validation.', getValidate(cssValidation));
}; It could be fixed by replacing the function getValidate with: function getValidate(validationType) {
return function () {
this.name = validationType || validate.name;
validate.apply(this, arguments);
};
} |
I applied the above fix and eliminated the task-not-found error; however, I am now receiving an unexpected token error:
The tasks in my Gruntfile.js are configured as follow. With some slight modification, I cut and pasted the task configuration from https://www.npmjs.com/package/grunt-w3c-validation. /* Validate HTML to HTML5 standard. */
html-validation: {
options: {
reset: grunt.option('reset') || false,
stoponerror: false,
relaxerror: ["Bad value X-UA-Compatible for attribute http-equiv on element meta."]
},
files: {
src: ['src/*.html']
}
},
/* Validate CSS to CSS3 standard. */
css-validation: {
options: {
reset: grunt.option('reset') || false,
stoponerror:false,
relaxerror: [],
profile: 'css3',
medium: 'all',
warnings: '0'
},
files: {
src: ['src/styles/*.css']
}
}, Sorry if this is a trivial error, and I just can't see it. I'm weary! Thanks in advance for any help you can offer. |
Hi @icn2you, according to your console output there is a syntax error in line 72 in your Gruntfile.js. In JavaScript a valid identifier (-> valid variable names) cannot contain a hyphen symbol (see http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm). The same rule applies to keys of key/value pairs in object literals. But you can use quoted property names in an object literal to circumvent this restriction like: { or { Hope this information will help you to solve your problem. |
I'm grateful for your help @jrauschenbusch; thank you. Please pardon my ignorance of JS. It will be short-lived I assure you! I am a bit surprised the developer wasn't aware of this issue. My best to you always. =) |
Getting following error -
C:\sample2>grunt
This what i have in Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
});
};
The text was updated successfully, but these errors were encountered: