有没有办法在不将其编译成 CSS 的情况下向 LESS 文件添加前缀?

Is there a way to add prefixes to LESS file without compiling it into CSS?

我试过autoprefixer and less-plugin-autoprefix,但似乎他们都在转换为CSS

后添加了前缀

我最终使用 postcss-lessautoprefixer

const gulp = require('gulp');
const postcss = require('gulp-postcss');
const syntax = require('postcss-less');
const autoprefixer = require('autoprefixer');

gulp.task('default', () =>
  gulp.src('less/*.less')
  .pipe(postcss([
    autoprefixer({ browsers: ['last 2 versions'] })
  ], { syntax }))
  .pipe(gulp.dest('build/less'))
);