如何在执行之前实现属性预处理,就像在Grunt中完成一样? [英] How to implement properties preprocessing before execution like it is done in Grunt?

查看:118
本文介绍了如何在执行之前实现属性预处理,就像在Grunt中完成一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,

pre> config {
dist:{
dir:dir1
},
clean:{
dirs:[
'< dist.dir>'
]
}
}


$ b ...

  config {
dist:{
dir :dir1
},
clean:{
dirs:[
dir1

}
}

npm模块对此负责?请告诉我如何以更好的方式实施它?谢谢!

解决方案

Grunt中的模板字符串来自 Lo-Dash 包。

参考资料: com / api / grunt.templaterel =nofollow> Grunt.template

  • LoDash模板


  • Grunt has syntax which is used to set and update configuration properties before task execution.

    For example,

    config {
      dist: {
         dir: "dir1"
      },
      clean: {
          dirs: [
              '<dist.dir>'
          ]
      }
    }
    

    becomes in memory to ...

    config {
      dist: {
         dir: "dir1"
      },
      clean: {
          dirs: [
              "dir1"
          ]
      }
    }
    

    What npm module is responsible for this? Please, advice me how to implement it in a better way? Thank you!

    解决方案

    Template Strings within Grunt come from the Lo-Dash package.

    References:

    这篇关于如何在执行之前实现属性预处理,就像在Grunt中完成一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆