Skip to content
Snippets Groups Projects
Commit 2add03c7 authored by Jeff Hanke's avatar Jeff Hanke Committed by Marijn Haverbeke
Browse files

[html-line addon] Play more nicely with node/webpack.

* Pass in and use the htmlhint module required.
* Check for verify() and try HTMLHint.HTMLHint if missing because of
  module nesting. it's require('htmlhint').HTMLHint in node.
parent 974b698f
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,8 @@
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "htmlhint"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
mod(CodeMirror, window.HTMLHint);
})(function(CodeMirror, HTMLHint) {
"use strict";
var defaultRules = {
......@@ -29,9 +29,11 @@
CodeMirror.registerHelper("lint", "html", function(text, options) {
var found = [];
if (!window.HTMLHint) {
if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint;
if (!HTMLHint) HTMLHint = window.HTMLHint;
if (!HTMLHint) {
if (window.console) {
window.console.error("Error: window.HTMLHint not defined, CodeMirror HTML linting cannot run.");
window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
}
return found;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment