krau.json 配置

krau.json

{
  // deploy 任务流
  "ftp": {
    "host": "127.0.0.1",
    "port": 22,
    "username": "root",
    "password": "password",
    "remotePath": "/home/frontend/workspace",
    "keepWrapFolder": true // true保留目录层级,false不保留层级
  },
  "jsdoc": false,
  // postcss 插件配置,覆盖默认配置
  "postcss": {
    // 此工具使用
    // postcss-easy-import、precss、postcss-pxtorem
    // rucksack-css、postcss-assets、autoprefixer
    // cssnano、postcss-reporter
    // 共 8 个插件
    "postcss-pxtorem": {
      "rootValue": 16
    },
    "rucksack-css": false // 设置为 false 禁用该插件
  },
  "webpack": {
    "banner": "@copyright ", // js 文件头, 例如在此编辑 copyright
    "no-common": false, // 是否生成 common.js
    "no-html-inject": false, // js 是否自动注入到 html 模板
    "entry-prefixer": "", // js 文件名前缀
    "entry-filter": [] // 过滤 webpack entry,如:["index"],则 index.wp.js 可进入编译流程
  },
  // 开发环境变量配置
  "default": {
    "client": {
      "port": 9000, //必需字段,本地开发服务 node 占用的端口
      "publicPath": "." //必需字段,static 文件 publicPath
    },
    "array": ["arr1", "arr2"], // example
    ...
  },
  // 预发环境变量拓展配置
  "experiment": {
    "client": {
      "publicPath": "http://exp.website.com"
    }
  },
  // 生产环境变量拓展配置
  "production": {
    "client": {
      "publicPath": "http://prod.website.com"
    }, 
    "array": ["arr3"],
    ...
  }
}

Last updated