English / 日本語
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.