void appendTo( @Nullable String[] mainSelector, CssFormatter formatter ) {
        try {
            String[] sel = selectors;

            for( int s = 0; s < sel.length; s++ ) {
                final String selector = sel[s];
                String str = SelectorUtils.replacePlaceHolder( formatter, selector, this );
                if( selector != str ) {
                    if( sel == selectors ) {
                        sel = sel.clone(); // we does not want change the declaration of this selectors
                    }
                    sel[s] = str;
                }
            }

            if( mainSelector == null ) {        // main ruls
                for( int i = 0; i < sel.length; i++ ) {
                    sel[i] = SelectorUtils.fastReplace( sel[i], "&", "" );
                }
            } else if( sel[0].charAt( 0 ) == '@' ) {
                // media
                bubbling( sel, mainSelector, formatter );
                return;
            } else {
                sel = SelectorUtils.merge( mainSelector, sel );
            }
            formatter.addMixin( this, null, variables );

            if( sel[0].startsWith( "@" ) ) {
                ruleset( sel, formatter );
            } else {
                if( properties.size() > 0 ) {
                    int size0 = formatter.getOutputSize();
                    CssFormatter block = formatter.startBlock( sel );
                    int size1 = block.getOutputSize();
                    appendPropertiesTo( block );
                    int size2 = block.getOutputSize();
                    block.endBlock();
                    if( block == formatter && size1 == size2 ) {
                        formatter.setOutputSize( size0 );
                    }
                }

                for( Formattable prop : properties ) {
                    if( prop instanceof Mixin ) {
                        ((Mixin)prop).appendSubRules( sel, formatter );
                    }
                }

                for( Rule rule : subrules ) {
                    if( rule.isValidCSS( formatter ) && !rule.isInlineRule( formatter) ) {
                        rule.appendTo( params != null ? mainSelector : sel, formatter );
                    }
                }
            }
            formatter.removeMixin();
        } catch( LessException ex ) {
            ex.addPosition( filename, line, column );
            throw ex;
        } catch( Exception ex ) {
            throw createException( ex );
        }
    }
void appendTo ( @ Nullable String [ ] mainSelector , CssFormatter formatter ) { try { String [ ] sel = selectors ; for ( int s = 0 ; s < sel . length ; s ++ ) { final String selector = sel [ s ] ; String str = SelectorUtils . replacePlaceHolder ( formatter , selector , this ) ; if ( selector != str ) { if ( sel == selectors ) { sel = sel . clone ( ) ; } sel [ s ] = str ; } } if ( mainSelector == null ) { for ( int i = 0 ; i < sel . length ; i ++ ) { sel [ i ] = SelectorUtils . fastReplace ( sel [ i ] , "&" , "" ) ; } } else if ( sel [ 0 ] . charAt ( 0 ) == '@' ) { bubbling ( sel , mainSelector , formatter ) ; return ; } else { sel = SelectorUtils . merge ( mainSelector , sel ) ; } formatter . addMixin ( this , null , variables ) ; if ( sel [ 0 ] . startsWith ( "@" ) ) { ruleset ( sel , formatter ) ; } else { if ( properties . size ( ) > 0 ) { int size0 = formatter . getOutputSize ( ) ; CssFormatter block = formatter . startBlock ( sel ) ; int size1 = block . getOutputSize ( ) ; appendPropertiesTo ( block ) ; int size2 = block . getOutputSize ( ) ; block . endBlock ( ) ; if ( block == formatter && size1 == size2 ) { formatter . setOutputSize ( size0 ) ; } } for ( Formattable prop : properties ) { if ( prop instanceof Mixin ) { ( ( Mixin ) prop ) . appendSubRules ( sel , formatter ) ; } } for ( Rule rule : subrules ) { if ( rule . isValidCSS ( formatter ) && ! rule . isInlineRule ( formatter ) ) { rule . appendTo ( params != null ? mainSelector : sel , formatter ) ; } } } formatter . removeMixin ( ) ; } catch ( LessException ex ) { ex . addPosition ( filename , line , column ) ; throw ex ; } catch ( Exception ex ) { throw createException ( ex ) ; } }
Append this rule the formatter.

@param mainSelector optional selectors of the calling rule if this is a mixin.
@param formatter current formatter