gulp-html-partial.js
function getAttributes(tag) {
        let running = true;
        const attributes = [];
        const regexp = /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g;

        while (running) {
            const match = regexp.exec(tag);

            if (match) {
                attributes.push({
                    key: match[1],
                    value: match[2]
                })
            } else {
                running = false;
            }
        }

        return attributes;
    }
function getAttributes(tag) {
        let running = true;
        const attributes = [];
        const regexp = /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g;

        while (running) {
            const match = regexp.exec(tag);

            if (match) {
                attributes.push({
                    key: match[1],
                    value: match[2]
                })
            } else {
                running = false;
            }
        }

        return attributes;
    }
function getAttributes ( tag ) { let running = true ; const attributes = [ ] ; const regexp = / (\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']? / g ; while ( running ) { const match = regexp . exec ( tag ) ; if ( match ) { attributes . push ( { key : match [ 1 ] , value : match [ 2 ] } ) } else { running = false ; } } return attributes ; }
Extracts attributes from template tags as an array of objects

@example of output
[
{
key: 'src',
value: 'partial.html'
},
{
key: 'title',
value: 'Some title'
}
]

@param {String} tag - tag to replace
@returns {Array.<Object>}
Extracts attributes from template tags as an array of objects