鍍金池/ 問答/HTML/ gulp-less 函數(shù)編譯報錯

gulp-less 函數(shù)編譯報錯

.px2px(@size, @px){
    @size: round(@px / 2) * 1px;
    [data-dpr="2"] & {
      @size: @px * 1px;
    }
    // for mx3
    [data-dpr="2.5"] & {
      @size: round(@px * 2.5 / 2) * 1px;
    }
    // for 小米note
    [data-dpr="2.75"] & {
      @size: round(@px * 2.75 / 2) * 1px;
    }
    [data-dpr="3"] & {
      @size: round(@px / 2 * 3) * 1px
    }
    // for 三星note4
    [data-dpr="4"] & {
      @size: @px * 2px;
    }
  }

當使用gulp-less編譯后,
錯誤提示:

You tried to parse Less with the standard CSS parser; try again with the postcss-less parser  92 |   .header-right{
  93 |       display: inline-block;
> 94 |       .px2px(font-size,36);
     |       ^
  95 |       line-height:88/@r;
  96 |       text-align: center;

請問前面的這個.px2px的方法該如何修改。或者說在gulp-less里是否有格外的配置參數(shù)。

回答
編輯回答
過客

應該是 loader 配置的問題 貼出來看一下

2017年7月17日 06:48
編輯回答
司令

是不是語法問題, 我沒寫過less, 你試一下把.去掉換成px2px 函數(shù)前面應該沒點把

2017年10月21日 20:21