Last active
December 23, 2016 18:06
Star
You must be signed in to star a gist
configure browserify to compile es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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