Posted over 2 years ago. Visible to the public.

Using external JavaScript libraries [1.5d]

Just like we use gems on the server, we use third party JavaScript libraries in the browser. These typically provide functionality like:

  • General support libraries like jQuery or lodash
  • Wysiwyg HTML editors
  • Datepickers
  • Sliders
  • Tooltips
  • Dialogs

Choosing and installing a JavaScript library

Take a look at the popular lodash library.

  • Try to understand what it does.
  • Lodash comes in two variants "Core build" and "Full build". Why is that? Why would you always prefer the "Core build" if sufficient?
  • Why does it mention "x kB gzipped"? How is that important?
  • Try to add lodash to MovieDB by simply downloading it and adding it to the asset pipeline.
    Where is a good place to put it?
    Can you find a way to make use of it?
  • Read about how we manage vendor libraries
  • Lodash also provides "CDN copies". What is a CDN? Why do you think we don't use them?
  • Lodash can also be installed via "npm". What is that? Why doesn't that work for us?
  • Often, JavaScript libraries come in "minified" versions. What does that mean? Is it important?

Exercise: Add a datepicker

In your MovieDB, add a "release date" field. Use the Rome date picker to add a UI. Remember to use unobtrusive JavaScript.

Owner of this card:

Avatar
Tobias Kraze
Last edit:
about 1 month ago
by Hannes Randow
Posted by Tobias Kraze to makandra Curriculum
This website uses cookies to improve usability and analyze traffic.
Accept or learn more