You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we have a API like this
var Minimize = require('minimize')
, minimize = new Minimize({});
var resultData = minimize.parse(content);
The reason is, in some situation, it needs to be in a callback which is expected to return a result from the parser,
For example, the string replace in place,
String.replace(Regex, callback_function(rawhtml_snippet_match) {
return minimize.parse(rawhtml_snippet_match);
});
Thanks.
The text was updated successfully, but these errors were encountered:
By the way, it is very nice that "this module parses the DOM as string as opposes to an object.", which I think make it possible to minify html templates.
This is a bit tricky, the callback is required by the htmlparser2 module, that module parses the DOM async. I'm not sure if that module has a sync procedure, i'll check it. Would it be possible to turn that logic around, like parse the rawhtml_snippet_match first and replace against that string after
As far as I can tell a fully sync method is not possible atm due to htmlparser2 using domHandler which is completely async, closing this for now. Feel free to re-open when you have an awesome idea to do this.
Can we have a API like this
var Minimize = require('minimize')
, minimize = new Minimize({});
var resultData = minimize.parse(content);
The reason is, in some situation, it needs to be in a callback which is expected to return a result from the parser,
For example, the string replace in place,
String.replace(Regex, callback_function(rawhtml_snippet_match) {
return minimize.parse(rawhtml_snippet_match);
});
Thanks.
The text was updated successfully, but these errors were encountered: