lib/timbits.js
function loadViews(timbit) {
  timbit.views = [];
  
  var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
    , folder = path.join(config.home, 'views', timbit.viewBase);
    
  if (fs.existsSync(folder)) {
   var files = fs.readdirSync(folder);
   files.forEach(function(file) {
     timbit.views.push(file.replace(pattern, ''));
   });
  }
  
  // We will attempt the default view anyway and hope the timbit knows what it is doing.
  if (timbit.views.length === 0) timbit.views.push(timbit.defaultView);
}
function loadViews(timbit) {
  timbit.views = [];
  
  var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
    , folder = path.join(config.home, 'views', timbit.viewBase);
    
  if (fs.existsSync(folder)) {
   var files = fs.readdirSync(folder);
   files.forEach(function(file) {
     timbit.views.push(file.replace(pattern, ''));
   });
  }
  
  // We will attempt the default view anyway and hope the timbit knows what it is doing.
  if (timbit.views.length === 0) timbit.views.push(timbit.defaultView);
}
function loadViews ( timbit ) { timbit . views = [ ] ; var pattern = new RegExp ( '\.' + timbits . app . settings [ 'view engine' ] + '$' ) , folder = path . join ( config . home , 'views' , timbit . viewBase ) ; if ( fs . existsSync ( folder ) ) { var files = fs . readdirSync ( folder ) ; files . forEach ( function ( file ) { timbit . views . push ( file . replace ( pattern , '' ) ) ; } ) ; } // We will attempt the default view anyway and hope the timbit knows what it is doing. if ( timbit . views . length === 0 ) timbit . views . push ( timbit . defaultView ) ; }
automagically load views for a given timbit
automagically load views for a given timbit