This guide provides information about different ways to develop and test SquibView.
There are several ways to develop SquibView, depending on your preferences and needs:
You can use Python’s built-in HTTP server for simple development:
# Python 3
python -m http.server
# Python 2
python -m SimpleHTTPServer
Run this command from the project root directory, then open your browser to http://localhost:8000/dev/debug.html (or any other debug file).
All debug HTML files now include import maps to properly resolve ES module dependencies:
<scripttype="importmap">
{
"imports": {
"tiny-emitter": "https://unpkg.com/tiny-emitter@2.1.0/dist/tinyemitter.min.js",
"diff-match-patch": "https://unpkg.com/diff-match-patch@1.0.5/index.js",
"turndown": "https://unpkg.com/turndown@7.1.2/dist/turndown.js"
}
}
</script>
These import maps allow browsers to resolve bare module specifiers like import TinyEmitter from "tiny-emitter"
to the actual URL from which to fetch the module.
For a more modern development experience with hot module replacement (HMR):
npm run dev
This command starts a Vite development server with HMR enabled. When you make changes to the source files, they will be automatically reflected in the browser without a full page reload.
For the most comprehensive development experience:
npm run dev:hmr
This command starts a custom development server with additional features:
The /dev
directory contains several debug HTML files for different purposes:
debug.html
- Basic editor with Markdown contentdebug-adv.html
- Advanced editor with additional controlsdebug-csv.html
- Editor configured for CSV contentdebug-slides.html
- Editor configured for Reveal.js presentationsdebug-dev.html
- Modern development environment with HMRTo run tests during development:
npm test
For a specific test file or pattern:
jest tests/SquibView.test.js --testNamePattern="pattern"
To build the distribution files:
npm run build
This command creates minified and non-minified versions of SquibView in the /dist
directory, including ESM, UMD, and standalone versions.
SquibView uses ES modules with named exports. When developing locally, module resolution is handled in one of three ways:
npm run dev
)npm run dev:hmr
)window.editor
SquibView.version.version
/dev
directoryeditor.onTextSelected(callback)