public function compile( $scss, $includes = [] ) {

		$scss = $this->prependLocalizedVars( $scss );

		try {
			$css = '/* Silence is golden. */'; // If no SCSS input was passed, prevent file write errors by putting a comment in the CSS output.
			$scssphp = new \Leafo\ScssPhp\Compiler;
			if ( ! empty( $scss ) || ! empty( $this->vars ) ) {
				$scssphp->setVariables( $this->vars );
				$scssphp->setImportPaths( $includes );
				$css = $scssphp->compile( $scss );
				$this->vars = []; // Reset
			}
		} catch ( \Exception $e ) {

			$error_message = print_r( $scssphp->getParsedFiles(), true ); // @codingStandardsIgnoreLine
			$_SESSION['pb_errors'][] = sprintf(
				__( 'There was a problem with SASS. Contact your site administrator. Error: %1$s %2$s', 'pressbooks' ),
				$e->getMessage(),
				"<pre>{$error_message}</pre>"
			);

			$this->logException( $e );

			if ( WP_DEBUG ) {
				$this->debug( "/* {$e->getMessage()} */", $scss, 'last-thrown-exception' );
			}

			return ''; // Return empty string on error
		}

		return $css;
	}
public function compile( $scss, $includes = [] ) {

		$scss = $this->prependLocalizedVars( $scss );

		try {
			$css = '/* Silence is golden. */'; // If no SCSS input was passed, prevent file write errors by putting a comment in the CSS output.
			$scssphp = new \Leafo\ScssPhp\Compiler;
			if ( ! empty( $scss ) || ! empty( $this->vars ) ) {
				$scssphp->setVariables( $this->vars );
				$scssphp->setImportPaths( $includes );
				$css = $scssphp->compile( $scss );
				$this->vars = []; // Reset
			}
		} catch ( \Exception $e ) {

			$error_message = print_r( $scssphp->getParsedFiles(), true ); // @codingStandardsIgnoreLine
			$_SESSION['pb_errors'][] = sprintf(
				__( 'There was a problem with SASS. Contact your site administrator. Error: %1$s %2$s', 'pressbooks' ),
				$e->getMessage(),
				"<pre>{$error_message}</pre>"
			);

			$this->logException( $e );

			if ( WP_DEBUG ) {
				$this->debug( "/* {$e->getMessage()} */", $scss, 'last-thrown-exception' );
			}

			return ''; // Return empty string on error
		}

		return $css;
	}
public function compile ( $ scss , $ includes = [ ] ) { $ scss = $ this -> prependLocalizedVars ( $ scss ) ; try { $ css = '/* Silence is golden. */' ; // If no SCSS input was passed, prevent file write errors by putting a comment in the CSS output. $ scssphp = new \ Leafo \ ScssPhp \ Compiler ; if ( ! empty ( $ scss ) || ! empty ( $ this -> vars ) ) { $ scssphp -> setVariables ( $ this -> vars ) ; $ scssphp -> setImportPaths ( $ includes ) ; $ css = $ scssphp -> compile ( $ scss ) ; $ this -> vars = [ ] ; // Reset } } catch ( \ Exception $ e ) { $ error_message = print_r ( $ scssphp -> getParsedFiles ( ) , true ) ; // @codingStandardsIgnoreLine $ _SESSION [ 'pb_errors' ] [ ] = sprintf ( __ ( 'There was a problem with SASS. Contact your site administrator. Error: %1$s %2$s' , 'pressbooks' ) , $ e -> getMessage ( ) , "<pre>{$error_message}</pre>" ) ; $ this -> logException ( $ e ) ; if ( WP_DEBUG ) { $ this -> debug ( "/* {$e->getMessage()} */" , $ scss , 'last-thrown-exception' ) ; } return '' ; // Return empty string on error } return $ css ; }
Returns the compiled CSS from SCSS input

@param string $scss
@param array $includes (optional)

@return string
Returns the compiled CSS from SCSS input