如何在Rails应用程序的ruby中使用ES6(ES2015)?

如何在Rails应用程序的ruby中使用ES6(ES2015)?

问题描述:

我有一个4.2 Rails应用程序,正在考虑将JS缓慢转换为ES6.现在,我正在使用资产管道中的标准rails清单文件来预处理我的js.

I have a 4.2 rails app and am considering slowly converting the JS to ES6. Right now I'm using the standard rails manifest file from the asset pipeline to pre-process my js.

我不确定该如何在Rails应用程序中开始使用ES6(添加转送步骤).

I'm not sure how to go about starting to use ES6 (adding a transpile step) in my rails app.

是否有内置方法,推荐的工具或工作流程?

Is there a built-in method, or a recommended tool or workflow?

3年后为自己解答...

Answering for myself 3 years later...

Rails> 5.1具有webpacker并且对webpack构建和各种前端框架(如果需要)(响应,vue等)具有本机支持

Rails > 5.1 has webpacker and native support for webpack builds and various front end frameworks if desired (react, vue, etc)