Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Latest commit

 

History

History
40 lines (30 loc) · 942 Bytes

js-libraries.md

File metadata and controls

40 lines (30 loc) · 942 Bytes

English / 日本語

Use JavaScript libraries

This framework uses npm for package management.
You can easily install frontend libraries using npm, and JS libraries can be bundled by Browserify.

Example: Use jQuery in the project

$ npm install jquery --save

index.html

<html>
  <body>
    <script src="scripts/main.js"></script>
  </body>
</html>

scripts/main.js

var $ = require('jquery');

$(function () {
  $('#message').text('Hello, jQuery!');
});

Browserify compiles JavaScript resolving file dependencies and global objects.

  • You don't need to insert <script src="path/to/jquery.js"></script> to HTML.
  • You don't need to take care of the global $ object.

See also