executablebooks / markdown-it-plugin-template

A template for creating a markdown-it plugin.
https://executablebooks.github.io/markdown-it-plugin-template/
MIT License
6 stars 3 forks source link

Utility to run local demo #5

Open rowanc1 opened 3 years ago

rowanc1 commented 3 years ago

Right now I believe the process is commenting on/off the local script and just opening this up in any webserver or file://.

It would be great to add a npm run start or dev to bring up a live reloading server on file changes (including styles where appropriate). This is more helpful for the more complicated repos like docutils.

This also means the deploy might need to go into a github action (e.g. have done that here), that would allow us to rely on the locally built package rather than the deployed npm package (e.g. not ready to release, but still want the demo updated).

chrisjsewell commented 3 years ago

Yeh I was already planning to do this. It shouldn't be that hard.

This is more helpful for the more complicated repos like docutils.

If you want to see changes, its not hard at all though: just got to docs/index.html and "swap" the css+js scripts in the header for the commented out local variants. Then you can just run npm run build every time you want to update, or just npm run sass if you are only changing the sass/scss files.

that would allow us to rely on the locally built package rather than the deployed npm package

so yeh if you do what I say above you can already rely on the locally built files

chrisjsewell commented 3 years ago

(note what I said above applies specifically to the setup in markdown-it-docutils)

rowanc1 commented 3 years ago

It would be great to get this in one command that gets a local demo up, watching/rebuilding/reloading, so we don't have to remember/or accidentally commit incorrect things. Have done this a bunch in webpack, I am sure there are simple equivalents in the rollup world.

chrisjsewell commented 3 years ago

oh yeh exactly, I just hadn;t got round to looking yet (plus figuring out how to have the index.html auto-use local scripts vs URL scripts, based on context)

chrisjsewell commented 3 years ago

Although there is obviously nothing stopping you from working it out 😜