lib/bower-file-manager.js
function createVirtualLessFileFromBowerJson(bowerJsonPath) {
  return new PromiseConstructor(function(fullfill, reject) {
    bowerJson.read(bowerJsonPath, { validate: false }, function(err, bowerJsonData) {
      if (err) {
        return reject(err);
      }
      if (!bowerJsonData.main) {
        err = bowerJsonPath + ' has no "main" property.';
        return reject(new Error(err));
      }

      // convert bower json into less file
      var virtualLessFile = bowerJsonData.main.filter(function(filename) {
        return path.extname(filename) === '.less';
      }).map(function(filename) {
        return '@import "' + filename + '";';
      }).join('\n');

      if (virtualLessFile) {
        var file = {
          contents: virtualLessFile,
          filename: bowerJsonPath
        };
        return fullfill(file);
      } else {
        err = 'Couldn\'t find a less file in ' + bowerJsonPath + '.';
        return reject(new Error(err));
      }
    });
  });
}
function createVirtualLessFileFromBowerJson(bowerJsonPath) {
  return new PromiseConstructor(function(fullfill, reject) {
    bowerJson.read(bowerJsonPath, { validate: false }, function(err, bowerJsonData) {
      if (err) {
        return reject(err);
      }
      if (!bowerJsonData.main) {
        err = bowerJsonPath + ' has no "main" property.';
        return reject(new Error(err));
      }

      // convert bower json into less file
      var virtualLessFile = bowerJsonData.main.filter(function(filename) {
        return path.extname(filename) === '.less';
      }).map(function(filename) {
        return '@import "' + filename + '";';
      }).join('\n');

      if (virtualLessFile) {
        var file = {
          contents: virtualLessFile,
          filename: bowerJsonPath
        };
        return fullfill(file);
      } else {
        err = 'Couldn\'t find a less file in ' + bowerJsonPath + '.';
        return reject(new Error(err));
      }
    });
  });
}
function createVirtualLessFileFromBowerJson ( bowerJsonPath ) { return new PromiseConstructor ( function ( fullfill , reject ) { bowerJson . read ( bowerJsonPath , { validate : false } , function ( err , bowerJsonData ) { if ( err ) { return reject ( err ) ; } if ( ! bowerJsonData . main ) { err = bowerJsonPath + ' has no "main" property.' ; return reject ( new Error ( err ) ) ; } // convert bower json into less file var virtualLessFile = bowerJsonData . main . filter ( function ( filename ) { return path . extname ( filename ) === '.less' ; } ) . map ( function ( filename ) { return '@import "' + filename + '";' ; } ) . join ( '\n' ) ; if ( virtualLessFile ) { var file = { contents : virtualLessFile , filename : bowerJsonPath } ; return fullfill ( file ) ; } else { err = 'Couldn\'t find a less file in ' + bowerJsonPath + '.' ; return reject ( new Error ( err ) ) ; } } ) ; } ) ; }
Tries to convert a Bower JSON into a virtual Less file.
@param {string} bowerJsonPath
@returns {PromiseConstructor}
Tries to convert a Bower JSON into a virtual Less file .