Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 Support Via Babel #1918

Closed
kkirsche opened this issue May 13, 2015 · 7 comments
Closed

ES6 Support Via Babel #1918

kkirsche opened this issue May 13, 2015 · 7 comments

Comments

@kkirsche
Copy link

Hey Padrino,

I wanted to check with you guys and see if there was any interest in automatic javascript transpiler from ES6 -> ES5 via the babel-transpiler gem. I wanted to check though if this was something of interest to you before beginning to work on this type of a feature though

@dariocravero
Copy link

Hey @kkirsche that's always welcome :). ES6 is the future and we should embrace it. Is this transpiler working on-the-fly? Thanks, Darío

@kkirsche
Copy link
Author

@dariocravero it is not an on the fly but I figure it or at least babel-core would provide the ability to extend the core functions to do it on the fly. Worst case though is I can work through the es6 module transpiler rails uses and use that as a basis to strip and refactor till we have something a bit thinner that'll work well with Padrino and it's goals

@dariocravero
Copy link

So would that work as a middleware that takes, say, .es6 files and compiles to .js? How would you deal with the module system? Would you pipe things say, through browserify?

@kkirsche
Copy link
Author

@dariocravero

Middleware was my plan. I'd had thought about running it on .es6.js as the extension and serve it to the browser as .js or .es5.js. My logic on that is that while we could run it on all .js files, there is no value in wasting resources on transpiling something to itself. You could though run .js -> .js though you could do .es6 and convert on the fly to .js for transpiling and serving. Would depend on how Padrino wanted to address the issue of ES6. My thought is there are two real options:

  • .js to .js — Simplest option for users and least likely to confuse people
  • .es6.js to .js || .es6 to .js — Makes sure that the developer understands what they are writing and relies on them to make the correct name. With that said, this should come with performance benefits as you can avoid all files without the extension and not have to do any analysis.

My guess is we will need to use something like Browserify for module though I haven't looked at any of the ES6 shims enough to be able to say if there is a shim which would be lighterweight.

What are your thoughts?

@nesquena nesquena modified the milestone: 0.13.1 Oct 12, 2015
@ujifgc ujifgc modified the milestone: 0.13.1 Dec 12, 2015
@skade
Copy link
Contributor

skade commented Jan 13, 2016

Wouldn't that introduce some kind of mini-asset-pipeline, which Padrino avoids doing currently?

#1028

Note that I know quite some users opting for Padrino because it doesn't care about how you handle JS.

@dariocravero
Copy link

@skade, yes, that would be an assets pipeline chore :).

@ujifgc
Copy link
Member

ujifgc commented May 5, 2016

Probably won't made it to the core library. I think it can be a nice padrino-recipe.

@ujifgc ujifgc closed this as completed May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants