Skip to content

Instantly share code, notes, and snippets.

@Chryus
Last active December 23, 2016 18:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Chryus/7610c9e074ae6db8d71d5744b91e09bf to your computer and use it in GitHub Desktop.
configure browserify to compile es6
# config/application.rb
# Configure Browserify to use babelify to compile ES6
config.browserify_rails.commandline_options = "-t [ babelify --presets [ es2015 ] ]"
# Run on all javascript files
config.browserify_rails.force = true
# Alternatively, only run on .es6 files
# config.browserify_rails.force = ->(file) { File.extname(file) == ".es6" }
unless Rails.env.production?
# Make sure Browserify is triggered when asked to serve javascript spec files
config.browserify_rails.paths << lambda { |p|
p.start_with?(Rails.root.join("spec/javascripts").to_s)
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment