leafo / scssphp

SCSS compiler written in PHP
MIT License
1.34k stars 214 forks source link

CompilerException: Undefined mixin media-breakpoint-only #709

Closed egolive closed 5 years ago

egolive commented 5 years ago

Hello, I try to compile bootstrap into a container.

This is my code:

    use Leafo\ScssPhp\Compiler;
    $scss = new Compiler();

    if( !ini_get('safe_mode') ){
        set_time_limit(0);
    }

    $path = plugin_dir_path( dirname( __FILE__ ) );
    $directors = array( $path.'assets/css/bootstrap/scss/', $path.'assets/css/bootstrap/scss/mixins/', $path.'assets/css/bootstrap/scss/utilities/', $path.'assets/css/bootstrap/scss/vendor/' );
    $scss->setImportPaths($directors);

    $compiledBootstrap .= $scss->compile('@import "bootstrap.scss";');

    $scssIn = file_get_contents(plugin_dir_path( dirname( __FILE__ ) ) . '/assets/css/ccs_style.scss');

    $scssIn = str_replace('$compiledBootstrap', $compiledBootstrap, $scssIn);

    $cssOut = $scss->compile($scssIn);

    file_put_contents(plugin_dir_path( dirname( __FILE__ ) ) . '/assets/css/ccs_style.css', $cssOut);

This is the scss

.ccs-content-area {
  $compiledBootstrap;
  box-sizing: border-box;
  font-family: sans-serif;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  margin: 0;
  font-weight: 400;
  color: #212529;
  text-align: left;
  background-color: #fff;
  position: relative;
  margin-bottom: 25px;
  margin-top: 25px;

...

@include media-breakpoint-only(xs) {
    .btn-block-res {
      display: block;
      width: 100%;
      font-size: 14px;
    }
  }

...

}

I become the following error message: Leafo\ScssPhp\Exception\CompilerException: Undefined mixin media-breakpoint-only: line: 6970

Does someone know what I'm doing wrong?

mahagr commented 5 years ago

This project has been moved to https://github.com/scssphp/scssphp

egolive commented 5 years ago

Thank you

robocoder commented 5 years ago

https://github.com/scssphp/scssphp/issues/15