index.js
// plugin level function (dealing with files)
plugin level function (dealing with files)
plugin level function ( dealing with files )
function gulpExtjs(options) {
    var entryFiles = [];
    var stream = through.obj(
        function(file, encoding, callback) {
            if (file.isStream()) {
                this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
                return callback();
            }
            if (file.isBuffer()) {
                entryFiles.push({
                    vinylFile: file,
                    encoding: encoding
                });
            }
            callback();
        },
        function(callback) {
            var me = this;
            if (entryFiles.length == 0) {
                me.emit('error', new PluginError(PLUGIN_NAME, 'No entry files provided'));
            }
            var cwd = entryFiles[0].vinylFile.cwd;
            var entryFilePaths = [],
                entryFilesByPath = {};
            entryFiles.forEach(function (entryFile) {
                var path = getRelativePathOfVinylFile(entryFile.vinylFile);
                entryFilePaths.push(path);
                entryFilesByPath[path] = entryFile;
            });
            var opts = extend({}, options); 
            opts.fileProvider = createVinylFileProvider(cwd, entryFilesByPath);
            opts.entry = entryFilePaths;
            try {
                var extFileInfos = extdeps.resolve(opts);
                extFileInfos.forEach(function(fileInfo) {
                    me.push(fileInfo.content.vinylFile);
                });
            } catch (e) {
                me.emit('error', new PluginError(PLUGIN_NAME, e));
            }
            callback();
        });
    return stream;
}
function gulpExtjs ( options ) { var entryFiles = [ ] ; var stream = through . obj ( function ( file , encoding , callback ) { if ( file . isStream ( ) ) { this . emit ( 'error' , new PluginError ( PLUGIN_NAME , 'Streams are not supported!' ) ) ; return callback ( ) ; } if ( file . isBuffer ( ) ) { entryFiles . push ( { vinylFile : file , encoding : encoding } ) ; } callback ( ) ; } , function ( callback ) { var me = this ; if ( entryFiles . length == 0 ) { me . emit ( 'error' , new PluginError ( PLUGIN_NAME , 'No entry files provided' ) ) ; } var cwd = entryFiles [ 0 ] . vinylFile . cwd ; var entryFilePaths = [ ] , entryFilesByPath = { } ; entryFiles . forEach ( function ( entryFile ) { var path = getRelativePathOfVinylFile ( entryFile . vinylFile ) ; entryFilePaths . push ( path ) ; entryFilesByPath [ path ] = entryFile ; } ) ; var opts = extend ( { } , options ) ; opts . fileProvider = createVinylFileProvider ( cwd , entryFilesByPath ) ; opts . entry = entryFilePaths ; try { var extFileInfos = extdeps . resolve ( opts ) ; extFileInfos . forEach ( function ( fileInfo ) { me . push ( fileInfo . content . vinylFile ) ; } ) ; } catch ( e ) { me . emit ( 'error' , new PluginError ( PLUGIN_NAME , e ) ) ; } callback ( ) ; } ) ; return stream ; }
plugin level function (dealing with files)
plugin level function ( dealing with files )
// creating a stream through which each file will pass // Create a shallow copy // returning the file stream