Skip to content

uWydnA/gulp-prefixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-prefixer

使用方法

const { src, dest, parallel } = require("gulp");
const gulpPrefixer = require("./plugins/index.js");

function copyLess(toDir) {
  return function copyAssets() {
    return src("src/**/*.less")
      .pipe(
        gulpPrefixer({
          prefix: "priviteKey", //前缀字符串
          prefixInCss: "#", // 选择器前缀,#或者.
        })
      )
      .pipe(dest(toDir));
  };
}

exports.default = parallel(copyLess("lib"), copyLess("es"));

产物对比

  • 源码
//index.less
@import "./custom.less";

//custom.less
.box {
  color: red;
}
.content {
  font-size: 12px;
}
  • 打包后产物
//index.less
@import "./custom.less";

//custom.less
#priviteKey {
  .box {
    color: red;
  }
  .content {
    font-size: 12px;
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published