lib/utils.js
function (target, mount, component) {
    var file = fs.readFileSync(target, 'utf-8');
    var $ = cheerio.load(file);
    //- returns true if any of the elements match mount, so throw if false
    if (!$(mount).is(mount)) { throw messages.errors.domNodeNotFound(mount); }
    //- write to html
    $(mount).append(component);
    fs.writeFileSync(target, $.html());
  }
function (target, mount, component) {
    var file = fs.readFileSync(target, 'utf-8');
    var $ = cheerio.load(file);
    //- returns true if any of the elements match mount, so throw if false
    if (!$(mount).is(mount)) { throw messages.errors.domNodeNotFound(mount); }
    //- write to html
    $(mount).append(component);
    fs.writeFileSync(target, $.html());
  }
function ( target , mount , component ) { var file = fs . readFileSync ( target , 'utf-8' ) ; var $ = cheerio . load ( file ) ; //- returns true if any of the elements match mount, so throw if false if ( ! $ ( mount ) . is ( mount ) ) { throw messages . errors . domNodeNotFound ( mount ) ; } //- write to html $ ( mount ) . append ( component ) ; fs . writeFileSync ( target , $ . html ( ) ) ; }
Insert the string into the target html file at the mount point
@param {string} target - path to html file
@param {string} mount - query for a dom node that the component will be injected into
@param {string} component - string representation of a react component
Insert the string into the target html file at the mount point