vendredi 22 juillet 2016

How to parse HTML to DOM with Grunt

I am new to Grunt, trying to find a way to load multiple HTML files and parse them to extract some values.

I tried to use jQuery.parseHTML, HTMLParser but both are not defined. Is there a way to include jQuery or a lib that can parse HTML?

grunt.config.init({
    concat: {
        options: {
            dest: 'tmp',
            templates: ['public/*.html']
        }
    }
});

var recursiveConcat = function(source, result){
    grunt.file.expand(source).forEach(function(file){
        var data = grunt.file.read(file);
        // parse html to dom
        result += data;
    });
    return result;
};

Aucun commentaire:

Enregistrer un commentaire