selectoplasm

Bun Installation

To run Selectoplasm with Bun, you can import the dev server provided in selectoplasm/bun in your dev script:

import { startSelectoplasmDevServer } from "selectoplasm/bun"

const options = { port: 3000 } // this is the entire possible options currently

startSelectoplasmDevServer("./index.dev.html", process.cwd(), options)

startSelectoplasmDevServer receives 3 arguments. The last one, options, is optional and defaults to { port: 3000 }, so in most cases you can leave it out entirely unless you want to change the default port.

The first 2 arguments are required. First, it needs the path to your index html file. Second, it needs the path to where it should put the ".selectoplasm" directory. The example above just passes process.cwd() which provides the project's root folder, but you can specify a different location if you wish. The selectoplasm dev server creates a number of endpoints for loading plugins, and saving and loading files. All of these operations will happen in the location you pass it here.

For the index.html file, I recommend creating an index.dev.html file and adding the following lines to it:

<selectoplasm-div id="selectoplasm"></selectoplasm-div>
<script src="node_modules/selectoplasm/dist/selectoplasm.js" defer></script>
<!-- defer the script so that Selectoplasm's stylesheets load last -->

This will ensure you don't accidentally include selectoplasm in your production builds, which would be naughty.

If you don't want more files in your project root than is necessary, you can put the index.dev.html file into the .selectoplasm directory. No need to change the script src from the above, the selectoplasm dev server will handle it.