Home

Awesome

This project is no longer maintained! Please use jspicl-cli instead.


rollup-plugin-jspicl

This plugin uses jspicl to convert your JavaScript into a PICO-8 cartridge with lua code.

Installation

npm install rollup-plugin-jspicl --save-dev

Related projects

jspicl - A Javascript to PICO-8 Lua transpiler

games - Games created with jspicl

Usage

import jspicl from "rollup-plugin-jspicl";

export default {
  input: "src/game.js",
  output: {
    file: "build/game.p8",
    format: "es"
  },
  plugins: [
    buble(),
    jspicl({
      // options
    })
  ]
})

Options

PropertyTypeDefaultDescription
cartridgePathstringPath to an existing cartridge to load map, music and sfx from. Ideally this should point to the generated cartridge so you can edit the assets directly. This setting however gives you the option to use a separate cartridge as the source for your assets. MANDATORY
includeBannerbooltrueAdds a comment at the very top of the generated bundle with jspicl info.
jsOutputstringOutput generated javascript code to a file. Useful for debugging when used in combination with astexplorer.
luaOutputstringOutput generated lua code to a file.
polyfillTransformpolyfills => stringundefinedCallback method for modifying the polyfills that are needed. An object hashmap will be passed in where the keys represent the function names and values the lua code. You may replace the existing polyfills with your own versions or even add additional ones.
showStatsbooltrueDisplay useful stats about the generated cartridge
spritesheetImagePathstringPath to a png image to be used as the spritesheet. Colors will be downsampled and mapped against PICO-8's fixed palette using a distance based approach. Using colors close to PICO-8's palette will yield best results. MANDATORY
picoobjectPICO-8 specific options. Default options will be used if not supplied. See table below for details.
jspiclobjectOptions to pass into jspicl. Default options will be used if not supplied. See repo for detailed info.

PICO-8 Options

PropertyTypeDefaultDescription
autoRunbooltrueStart up PICO-8 when starting the build with npm start
customPicoPathstringPath to PICO-8. If not specified the default path will be used.
pipeOutputToConsoleboolfalseWhen true, will output console.log calls to terminal that launched PICO-8.
reloadOnSavebooltrueAutomatically reload the cart when source files have been modified.

Versioning

This project uses semantic versioning