博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ajax minifier_ES6 JavaScript Minifier:babili
阅读量:2517 次
发布时间:2019-05-11

本文共 2663 字,大约阅读时间需要 8 分钟。

ajax minifier

The Babel toolchain is amazing.  We've used Babel to  well before ES6 features hit browsers, we use it to parse JavaScript and write JSX, and much more.  Babel can do just about anything with the JavaScript language and I've just learned of another use for the Babel toolchain:  .

Babel工具链很棒。 在ES6功能进入浏览器之前,我们已经使用Babel ,我们使用它来解析JavaScript和编写JSX等。 Babel可以使用JavaScript语言执行几乎所有操作,而且我刚刚了解到Babel工具链的另一种用途: 。

At the time of its creation, many other JavaScript minifiers weren't capable of ES6 minifying but when you have an amazing, forward-thinking parser like Babel, creating an ES6+ aware minifier becomes much easier.

在创建它时,许多其他JavaScript压缩程序都无法进行ES6压缩,但是当您拥有像Babel这样令人惊叹的,具有前瞻性的解析器时,创建支持ES6 +的压缩程序将变得更加容易。

从命令行使用babili (Using babili from Command Line)

I prefer to use babili from command line when doing a quick minification:

快速缩小时,我更喜欢从命令行使用babili:

// Sample source code:class Mangler {  constructor(program) {    this.program = program;  }}new Mangler(); // without this it would just output nothing since Mangler isn't used// Before:// ES2015+ code -> Babel -> Babili/Uglify -> Minified ES5 Codevar a=function a(b){_classCallCheck(this,a),this.program=b};new a;// After:// ES2015+ code -> Babili -> Minified ES2015+ Codeclass a{constructor(b){this.program=b}}new a;

Note that babili does not transpile ES5 JavaScript before minifying -- you'll need to use an excellent tool like to get ES6+ from ES5.  Assuming you do have ES6 in your source file, you'll notice all of your code has been elegantly minified by babili!

需要注意的是巴比利 transpile ES5JavaScript涅槃之前-你需要使用像一个很好的工具从ES5来获得ES6 +。 假设您的源文件中确实有ES6,您会发现babili巧妙地缩小了所有代码!

通过Node.js使用babili (Using babili via Node.js)

Being a JavaScript parser implemented in JavaScript, babili is also available for use via Node.js APIs.  There are also dozens of you can use to customize your minification.  Check out the documentation for  and Node.js usage information.

babili是用JavaScript实现JavaScript解析器,也可以通过Node.js API使用。 您还可以使用数十个来自定义缩小版本。 查阅文档以获取和Node.js使用信息。

Babel has had as much of an impact on writing JavaScript for the web as any popular JavaScript frameworks and will continue to do so in the future.  If you haven't explored the  and it's plethora of plugins, take the time to give them a look.  Being able to write and experiment with edge JavaScript language features before they hit the browsers is an advantage to any developer, whether it be in getting them a job or simply keeping them up to speed with the language.

Babel与任何流行JavaScript框架一样,对Web上JavaScript产生了很大的影响,并且将来会继续这样做。 如果您还没有探索并且它有太多的插件,请花一些时间看看它们。 对于开发人员来说,能够在边缘JavaScript语言功能进入浏览器之前对其进行编写和试验是一个优势,无论是让他们找到一份工作,还是简单地使其与语言保持同步。

翻译自:

ajax minifier

转载地址:http://yfvwd.baihongyu.com/

你可能感兴趣的文章
2019年2月
查看>>
Google Noto Sans CJK 字体
查看>>
ES集群性能调优链接汇总
查看>>
STL库的应用
查看>>
spark算子
查看>>
(转)Linux服务器SNMP常用OID
查看>>
zoj2112 主席树动态第k大 ( 参考资料链接)
查看>>
弹出框popupWindow
查看>>
Python学习(007)-函数的特性
查看>>
扑克牌的顺子
查看>>
nodejs + express 热更新
查看>>
ClientScriptManager.RegisterClientScriptBlock Method 无效
查看>>
asp.net web site中reference的version的autoupdate
查看>>
第4章 网络层
查看>>
volatile
查看>>
项目需求分析答辩总结
查看>>
mysql-6正则表达式
查看>>
廖雪峰Java2面向对象编程-5包和classpath-1包package
查看>>
廖雪峰Java7处理日期和时间-3java.time的API-1LocalDateTime
查看>>
利用golang语法检查对象是否实现了接口
查看>>