How to install and set up Concert.js:
Browser Compatibility: Concert.js should work well on almost any browser currently in use. Presently, the code is linted against a feature and API set going back to major browser versions from roughly 2011.
Everything you need can be downloaded from the downloads page.
The zipped archive found there contains the following:
If you need an older version, visit the releases page on GitHub.
If you'd prefer to install and keep Concert.js up-to-date using npm, you can. From within your project directory, run:
npm install concert.js --save-dev
(Or without the --save-dev
if you want the concert.js package
installed as a regular dependency instead of a dev dependency of your project.)
Concert.js is easy to include as a regular script or with any of the common module formats (AMD, CommonJS, and ES Modules).
There are two versions of the code: 1) A minified version, much smaller and obfuscated, for production use; and 2) A full-sized version useful for debugging, exploring code, or demonstrating.
Anywhere below the file Concert.js
or Concert.mjs
is referenced,
you'll want to substitute Concert.min.js
or Concert.min.mjs
in order to use the minified version.
Not much to it; just include the script:
<script src="/YOUR_SCRIPT_PATH/Concert.js"></script>
If you're using an AMD loader, you'd do something like this:
require(["PATH_TO_CONCERT/Concert"],
function(Concert)
{
// Your code here
}
);
For a CommonJS loader (e.g., Browserify) using a direct path (if you downloaded Concert.js source directly):
let Concert = require("PATH_TO_CONCERT/Concert");
// Your code here
For a CommonJS loader (e.g., Browserify) if you installed the concert.js npm package:
let Concert = require("concert.js");
// The npm package name is all lowercase
// Your code here
If you can rely on users having only recent browsers, you can even use ES Module imports. In your HTML:
<script type="module" src="/YOUR_JS_CODE_MODULE.js"></script>
In your JavaScript:
import {Concert} from "/PATH_TO_CONCERT/Concert.mjs";
// Be aware of valid ES Module path syntax
// Your code here...
Important note: If you get a MIME type error, you can solve this by:
text/javascript
MIME type for .mjs
files; ORConcert.mjs
to something like ConcertModule.js so the server knows to serve it up with the right MIME type.