rails--rails/actionview
Ross Kaffenberger 04cbaa1475 Use ES module syntax for application.js.tt and docs
This change swaps the CommonJS require() syntax in the Webpacker
application.js pack template file and in documentation examples with ES
module import syntax.

Benefits of this change include:

Provides continuity with the larger frontend community: Arguably, one of
the main draws in adopting Webpacker is its integration with Babel to
support ES module syntax. For a fresh Rails install with Webpacker, the
application.js file will be the first impression most Rails developers
have with webpack and Webpacker.  Most of the recent documentation and
examples they will find online for using other libraries will be based
on ES module syntax.

Reduces confusion: Developers commonly add ES imports to their
application.js pack, typically by following online examples, which means
mixing require() and import statements in a single file. This leads to
confusion and unnecessary friction about differences between require()
and import.

Embraces browser-friendliness: The ES module syntax forward-looking and
is meant to be supported in browsers. On the other hand, require()
syntax is synchronous by design and not browser-supported as CommonJS
originally was adopted in Node.js for server-side JavaScript. That
webpack supports require() syntax is merely a convenience.

Encourages best practices regarding optimization: webpack can statically
analyze ES modules and "tree-shake", i.e., strip out unused exports from
the final build (given certain conditions are met, including
`sideEffects: false` designation in package.json).
2020-06-16 15:12:12 -04:00
..
app/assets/javascripts Use ES module syntax for application.js.tt and docs 2020-06-16 15:12:12 -04:00
bin Use frozen string literal in actionview/ 2017-07-24 11:53:43 +03:00
lib Address to false negative for Performance/DeletePrefix,DeleteSuffix 2020-06-14 13:04:47 +09:00
test Address to false negative for Performance/DeletePrefix,DeleteSuffix 2020-06-14 13:04:47 +09:00
.gitignore Clean up and consolidate .gitignores 2018-02-17 14:26:19 -08:00
CHANGELOG.md Fixup CHANGELOGs [ci skip] 2020-06-07 12:58:22 +09:00
MIT-LICENSE Bump license years from 2019 to 2020 [ci skip] 2020-01-01 15:10:31 +05:30
README.rdoc Update the Rails mailing list URLs to new discuss discourse URL [ci skip] 2020-04-02 22:00:28 +05:30
RUNNING_UJS_TESTS.rdoc Fix typos and add a few suggestions 2017-11-28 19:27:43 +01:00
RUNNING_UNIT_TESTS.rdoc Fix typos and add a few suggestions 2017-11-28 19:27:43 +01:00
Rakefile Load framework test files in deterministic order 2019-12-16 16:55:06 +00:00
actionview.gemspec Update the Rails mailing list URLs to new discuss discourse URL [ci skip] 2020-04-02 22:00:28 +05:30
blade.yml Add rails-ujs to Action View 2016-11-26 01:23:07 -05:00
coffeelint.json Test rails-ujs in our travis matrix 2017-02-22 13:49:28 -05:00
package.json update package.json files to use https homepage value 2019-10-02 12:00:11 +02:00

README.rdoc

= Action View

Action View is a framework for handling view template lookup and rendering, and provides
view helpers that assist when building HTML forms, Atom feeds and more.
Template formats that Action View handles are ERB (embedded Ruby, typically
used to inline short Ruby snippets inside HTML), and XML Builder.

You can read more about Action View in the {Action View Overview}[https://edgeguides.rubyonrails.org/action_view_overview.html] guide.

== Download and installation

The latest version of Action View can be installed with RubyGems:

  $ gem install actionview

Source code can be downloaded as part of the Rails project on GitHub:

* https://github.com/rails/rails/tree/master/actionview


== License

Action View is released under the MIT license:

* https://opensource.org/licenses/MIT


== Support

API documentation is at

* https://api.rubyonrails.org

Bug reports for the Ruby on Rails project can be filed here:

* https://github.com/rails/rails/issues

Feature requests should be discussed on the rails-core mailing list here:

* https://discuss.rubyonrails.org/c/rubyonrails-core