plugin.js
function configure() {
      var pkg = this.square.package
        , configuration = pkg.configuration
        , type = this.type || Plugin.modifier
        , self = this
        , load = [];

      // Check for the distribution and if it should accept the given extension,
      // extend self with the context of the plugin.
      if (!~type.indexOf('once') && (!this.distributable() || !this.accepted())) {
        this.logger.debug(
            'disregarding this plugin for extension: '+ this.extension
          +', distribution: '+ this.distribution
        );
        return this.emit('disregard');
      }

      // Check if there are any configuration options in the package.
      if (_.isObject(pkg.plugins) && this.id in pkg.plugins) {
        this.merge(this, pkg.plugins[this.id]);
      }

      // Merge in the plugin configuration.
      if (
           configuration
        && _.isObject(configuration.plugins)
        && this.id in configuration.plugins
      ) {
        this.merge(this, configuration.plugins[this.id]);
      }

      // Check if the bundle it self also had specific configurations for this
      // plugin.
      if (this.id in this && _.isObject(this[this.id])) {
        this.merge(this, this[this.id]);
      }

      // Ensure that our requires is an array, before we continue
      if (!Array.isArray(this.requires)) this.requires = [this.requires];

      // Check if we need to lazy load any dependencies
      if (this.requires && this.requires.length) {
        load = this.requires.map(function (file) {
          if (typeof file !== 'object') return file;
          if (!('extension' in file)) return file.name || file;
          if (file.extension === self.extension) return file.name || file;

          return undefined;
        }).filter(Boolean); // Only get existing files

        // Only fetch shizzle when we actually have shizzle to fetch here
        if (load.length) return canihaz.apply(canihaz, load.concat(function canihaz(err) {
          if (err) return self.emit('error', err);

          // Add all the libraries to the context, the `canihaz#all` returns an
          // error first, and then all libraries it installed or required in the
          // order as given to it, which is in our case the `this.requires` order.
          Array.prototype.slice.call(arguments, 1).forEach(function (lib, index) {
            self[load[index]] = lib;
          });

          // We are now fully initialized.
          if (self.initialize) self.initialize();
        }));
      }

      // We are now fully initialized.
      if (self.initialize) self.initialize();
    }
function configure() {
      var pkg = this.square.package
        , configuration = pkg.configuration
        , type = this.type || Plugin.modifier
        , self = this
        , load = [];

      // Check for the distribution and if it should accept the given extension,
      // extend self with the context of the plugin.
      if (!~type.indexOf('once') && (!this.distributable() || !this.accepted())) {
        this.logger.debug(
            'disregarding this plugin for extension: '+ this.extension
          +', distribution: '+ this.distribution
        );
        return this.emit('disregard');
      }

      // Check if there are any configuration options in the package.
      if (_.isObject(pkg.plugins) && this.id in pkg.plugins) {
        this.merge(this, pkg.plugins[this.id]);
      }

      // Merge in the plugin configuration.
      if (
           configuration
        && _.isObject(configuration.plugins)
        && this.id in configuration.plugins
      ) {
        this.merge(this, configuration.plugins[this.id]);
      }

      // Check if the bundle it self also had specific configurations for this
      // plugin.
      if (this.id in this && _.isObject(this[this.id])) {
        this.merge(this, this[this.id]);
      }

      // Ensure that our requires is an array, before we continue
      if (!Array.isArray(this.requires)) this.requires = [this.requires];

      // Check if we need to lazy load any dependencies
      if (this.requires && this.requires.length) {
        load = this.requires.map(function (file) {
          if (typeof file !== 'object') return file;
          if (!('extension' in file)) return file.name || file;
          if (file.extension === self.extension) return file.name || file;

          return undefined;
        }).filter(Boolean); // Only get existing files

        // Only fetch shizzle when we actually have shizzle to fetch here
        if (load.length) return canihaz.apply(canihaz, load.concat(function canihaz(err) {
          if (err) return self.emit('error', err);

          // Add all the libraries to the context, the `canihaz#all` returns an
          // error first, and then all libraries it installed or required in the
          // order as given to it, which is in our case the `this.requires` order.
          Array.prototype.slice.call(arguments, 1).forEach(function (lib, index) {
            self[load[index]] = lib;
          });

          // We are now fully initialized.
          if (self.initialize) self.initialize();
        }));
      }

      // We are now fully initialized.
      if (self.initialize) self.initialize();
    }
function configure ( ) { var pkg = this . square . package , configuration = pkg . configuration , type = this . type || Plugin . modifier , self = this , load = [ ] ; // Check for the distribution and if it should accept the given extension, // extend self with the context of the plugin. if ( ! ~ type . indexOf ( 'once' ) && ( ! this . distributable ( ) || ! this . accepted ( ) ) ) { this . logger . debug ( 'disregarding this plugin for extension: ' + this . extension + ', distribution: ' + this . distribution ) ; return this . emit ( 'disregard' ) ; } // Check if there are any configuration options in the package. if ( _ . isObject ( pkg . plugins ) && this . id in pkg . plugins ) { this . merge ( this , pkg . plugins [ this . id ] ) ; } // Merge in the plugin configuration. if ( configuration && _ . isObject ( configuration . plugins ) && this . id in configuration . plugins ) { this . merge ( this , configuration . plugins [ this . id ] ) ; } // Check if the bundle it self also had specific configurations for this // plugin. if ( this . id in this && _ . isObject ( this [ this . id ] ) ) { this . merge ( this , this [ this . id ] ) ; } // Ensure that our requires is an array, before we continue if ( ! Array . isArray ( this . requires ) ) this . requires = [ this . requires ] ; // Check if we need to lazy load any dependencies if ( this . requires && this . requires . length ) { load = this . requires . map ( function ( file ) { if ( typeof file !== 'object' ) return file ; if ( ! ( 'extension' in file ) ) return file . name || file ; if ( file . extension === self . extension ) return file . name || file ; return undefined ; } ) . filter ( Boolean ) ; // Only get existing files // Only fetch shizzle when we actually have shizzle to fetch here if ( load . length ) return canihaz . apply ( canihaz , load . concat ( function canihaz ( err ) { if ( err ) return self . emit ( 'error' , err ) ; // Add all the libraries to the context, the `canihaz#all` returns an // error first, and then all libraries it installed or required in the // order as given to it, which is in our case the `this.requires` order. Array . prototype . slice . call ( arguments , 1 ) . forEach ( function ( lib , index ) { self [ load [ index ] ] = lib ; } ) ; // We are now fully initialized. if ( self . initialize ) self . initialize ( ) ; } ) ) ; } // We are now fully initialized. if ( self . initialize ) self . initialize ( ) ; }
Configure the plugin, prepare all the things.

@api private
Configure the plugin prepare all the things .