function make_demo(opts){
  // Assemble our paths
  var indexhtml_path = path.join(process.cwd(), '/build/index.html')
  var demo_path = path.join(process.cwd(), opts.sub_component_path, 'demo.jade')
  var index_path = path.join(__dirname, '../templates/', opts.template+'.jade')

  // If there is already an index.html then watch out;
  // We should NOT just overwrite it!
  // The user should be prompted to resolve this.
  // Fatal! Fatal! Fatal!
  if (fs.existsSync(indexhtml_path)) index_exists_error()

  // Create the temporary index.html file
  // which contains the user's demo
  var index_opts = merge({
      title: resolve_name(opts.sub_component_path),
      body: render_jade(demo_path)
    },
    opts.index_locals
  )
  var indexhtml = render_jade(index_path, index_opts)
  fs.writeFileSync(indexhtml_path, indexhtml)

  // Once this program exists
  // clean up our temporary index.html file
  process.once('exit', fs.unlinkSync.bind(fs, indexhtml_path))
}
/* Read the local demo.jade file and
Inject it into parent template. */
Read the local demo.jade file and
Inject it into parent template.
Read the local demo . jade file and Inject it into parent template .
function make_demo(opts){
  var indexhtml_path = path.join(process.cwd(), '/build/index.html')
  var demo_path = path.join(process.cwd(), opts.sub_component_path, 'demo.jade')
  var index_path = path.join(__dirname, '../templates/', opts.template+'.jade')
  if (fs.existsSync(indexhtml_path)) index_exists_error()
  var index_opts = merge({
      title: resolve_name(opts.sub_component_path),
      body: render_jade(demo_path)
    },
    opts.index_locals
  )
  var indexhtml = render_jade(index_path, index_opts)
  fs.writeFileSync(indexhtml_path, indexhtml)
  process.once('exit', fs.unlinkSync.bind(fs, indexhtml_path))
}
function make_demo ( opts ) { var indexhtml_path = path . join ( process . cwd ( ) , '/build/index.html' ) var demo_path = path . join ( process . cwd ( ) , opts . sub_component_path , 'demo.jade' ) var index_path = path . join ( __dirname , '../templates/' , opts . template + '.jade' ) if ( fs . existsSync ( indexhtml_path ) ) index_exists_error ( ) var index_opts = merge ( { title : resolve_name ( opts . sub_component_path ) , body : render_jade ( demo_path ) } , opts . index_locals ) var indexhtml = render_jade ( index_path , index_opts ) fs . writeFileSync ( indexhtml_path , indexhtml ) process . once ( 'exit' , fs . unlinkSync . bind ( fs , indexhtml_path ) ) }
Read the local demo.jade file and
Inject it into parent template.
Read the local demo . jade file and Inject it into parent template .
// Assemble our paths // If there is already an index.html then watch out; // We should NOT just overwrite it! // The user should be prompted to resolve this. // Fatal! Fatal! Fatal! // Create the temporary index.html file // which contains the user's demo // Once this program exists // clean up our temporary index.html file