src/transformer.js
function _replaceTheme( doc, theme ) {
    const HAS_THEME = /(theme-)[^"'\s]+/;

    if ( !theme ) {
        return doc;
    }

    const formClassAttr = doc.root().get( '/root/form' ).attr( 'class' );
    const formClassValue = formClassAttr.value();

    if ( HAS_THEME.test( formClassValue ) ) {
        formClassAttr.value( formClassValue.replace( HAS_THEME, `$1${theme}` ) );
    } else {
        formClassAttr.value( `${formClassValue} theme-${theme}` );
    }

    return doc;
}
function _replaceTheme( doc, theme ) {
    const HAS_THEME = /(theme-)[^"'\s]+/;

    if ( !theme ) {
        return doc;
    }

    const formClassAttr = doc.root().get( '/root/form' ).attr( 'class' );
    const formClassValue = formClassAttr.value();

    if ( HAS_THEME.test( formClassValue ) ) {
        formClassAttr.value( formClassValue.replace( HAS_THEME, `$1${theme}` ) );
    } else {
        formClassAttr.value( `${formClassValue} theme-${theme}` );
    }

    return doc;
}
function _replaceTheme ( doc , theme ) { const HAS_THEME = / (theme-)[^"'\s]+ / ; if ( ! theme ) { return doc ; } const formClassAttr = doc . root ( ) . get ( '/root/form' ) . attr ( 'class' ) ; const formClassValue = formClassAttr . value ( ) ; if ( HAS_THEME . test ( formClassValue ) ) { formClassAttr . value ( formClassValue . replace ( HAS_THEME , ` ${ theme } ` ) ) ; } else { formClassAttr . value ( ` ${ formClassValue } ${ theme } ` ) ; } return doc ; }
Replaces the form-defined theme

@param  {[type]} doc   libxmljs object
@param  {string} theme theme
@return {[type]}       libxmljs object
Replaces the form - defined theme