/jsPsych_bundler

Bundles jsPsych and a list of plugins into a single file

Primary LanguageJavaScript

jsPsych_bundler

By virtue of its plugin architecture, jsPsych is very extensible. However, since each plugin is contained in a separate JavaScript file, downloading a lot of plugins from a web-server can cause high server load and make your experiment load relatively slowly. The jsPsych_bunder bundles jsPsych and a list of plugins into a single file, so that only one JavaScript file needs to be included.

Installing the bundler

Clone jsPsych

Clone the jsPsych repository to your hard drive, for example via the GitHub GUI.

Install Node and NPM

Node and NPM can be downloaded via this link.

Download required files from this repo

From this repo, download plugins.json and webpack.config.js. Put these files in the directory where you cloned jsPsych.

Go to the jsPsych directory

Open a command prompt and go to the directory on your hard drive where you cloned the jsPsych repository.

Install webpack and webpack-cli

In the command prompt, run the following two statements:

npm install webpack
npm install webpack-cli

Now you're set to go!

Configuring the bundler

The file plugins.json contains a JSON array with plugins you'd like to bundle with jsPsych. Put the plugins your experiment requires in this file.

Running the bundler

Run the statement below to make a file jspsych.bundle.js. This file will contain jsPsych and the plugins you've listed in plugins.json.

webpack