Skip to content

how to use babel transpiler in ruby #291

@bharathsn0812

Description

@bharathsn0812

Hi,

I am novice to ruby also es6

have created file foo.es6 which contains below code

class View {
  constructor(options) {
    this.model = options.model;
    this.template = options.template;
  }

  render() {
    return _.template(this.template, this.model.toObject());
  }
}

in ubuntu command line
sudo gem install babel-transpiler
-which installed babel-gem

then running ruby file esjs.rb

require 'babel/transpiler'
Babel::Transpiler.transform File.read("foo.es6")

will this convert es6 to js??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions