index.js
function findPartials(source, source_path, options, deps) {
  var reg = /({>\s?")([^"{}]+)("[\s\S]*?\/})/g, // matches dust partial syntax
    result = null, partial,
    dep, name, replace;

  // search source & add a dependency for each match
  while ((result = reg.exec(source)) !== null) {
    partial = {
      prefix: result[1],
      name: result[2],
      suffix: result[3]
    };

    // add to dependencies
    name = addDustDependency(partial.name, source_path, options, deps);

    // retrieve newest dependency
    dep = deps[deps.length - 1];

    // log
    log(options, 'found partial dependency "' + partial.name + '"');

    // if the partial has been renamed, update the name in the template
    if (name != partial.name) {
      log(options, 'renaming partial "' + partial.name + '" to "' + name + '"')

      // build replacement for partial tag
      replace = partial.prefix + name + partial.suffix;

      // replace the original partial path with the new "absolute" path (relative to root)
      source = source.substring(0, result.index) + replace + source.substring(result.index + result[0].length);

      // update regex index
      reg.lastIndex += (replace.length - result[0].length);
    }
  }

  return source;
}
function findPartials(source, source_path, options, deps) {
  var reg = /({>\s?")([^"{}]+)("[\s\S]*?\/})/g, // matches dust partial syntax
    result = null, partial,
    dep, name, replace;

  // search source & add a dependency for each match
  while ((result = reg.exec(source)) !== null) {
    partial = {
      prefix: result[1],
      name: result[2],
      suffix: result[3]
    };

    // add to dependencies
    name = addDustDependency(partial.name, source_path, options, deps);

    // retrieve newest dependency
    dep = deps[deps.length - 1];

    // log
    log(options, 'found partial dependency "' + partial.name + '"');

    // if the partial has been renamed, update the name in the template
    if (name != partial.name) {
      log(options, 'renaming partial "' + partial.name + '" to "' + name + '"')

      // build replacement for partial tag
      replace = partial.prefix + name + partial.suffix;

      // replace the original partial path with the new "absolute" path (relative to root)
      source = source.substring(0, result.index) + replace + source.substring(result.index + result[0].length);

      // update regex index
      reg.lastIndex += (replace.length - result[0].length);
    }
  }

  return source;
}
function findPartials ( source , source_path , options , deps ) { var reg = / ({>\s?")([^"{}]+)("[\s\S]*?\/}) / g , // matches dust partial syntax result = null , partial , dep , name , replace ; // search source & add a dependency for each match while ( ( result = reg . exec ( source ) ) !== null ) { partial = { prefix : result [ 1 ] , name : result [ 2 ] , suffix : result [ 3 ] } ; // add to dependencies name = addDustDependency ( partial . name , source_path , options , deps ) ; // retrieve newest dependency dep = deps [ deps . length - 1 ] ; // log log ( options , 'found partial dependency "' + partial . name + '"' ) ; // if the partial has been renamed, update the name in the template if ( name != partial . name ) { log ( options , 'renaming partial "' + partial . name + '" to "' + name + '"' ) // build replacement for partial tag replace = partial . prefix + name + partial . suffix ; // replace the original partial path with the new "absolute" path (relative to root) source = source . substring ( 0 , result . index ) + replace + source . substring ( result . index + result [ 0 ] . length ) ; // update regex index reg . lastIndex += ( replace . length - result [ 0 ] . length ) ; } } return source ; }
Find DustJS partials
Find DustJS partials