Mockitup svelte template
A test to set up a degit template for quick creation of Svelte mockups embedded into existing apps
Create new directory/repo
// create new directory
npx degit swiftaff/mockitup-svelte-template <new-project-directory-name>
cd <new-project-directory-name>
// install node_modules dependencies
npm i
// commit benchmark files to git
git init
git add -A
git commit -m "first commit"
Generate singleFileExport.html as basis for the mockup
- For convenience, or if the site/page is authenticated, use the Firefox extension to download the page as a ZIP:
https://addons.mozilla.org/firefox/addon/singlefilez
- OR, assuming the page is public you can install peer dependency single-filez-cli:
https://github.com/gildas-lormeau/single-filez-cli#run
[^bignote]
- npm install -g "gildas-lormeau/single-filez-cli" - if this doesn't work:
- cd C:\Users<username>\AppData\Roaming\npm\node_modules
- npm install "gildas-lormeau/single-filez-cli"
- npm i
- add "C:\Users<username>\AppData\Roaming\npm\node_modules\single-filez-cli" to your environment variables PATH
cd public
- TODO: it only works on public pages - if you need to access password protected then look at using cookies option in puppeteer?
- run it - probably need to use the browser executable option to find chrome
single-filez https://www.ibc.com.au export.html --browser-executable-path "C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"
- Open the exported zip file in a browser and check it works
- Rename
export.html
to export.zip
- unzip the contents of the zip - so that the assets are saved in the
public
directory
- move the
index.html
file to the root
- Insert svelte script into body where mockup element should appear in dom
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
Run dev server
npm run dev
- Vite may display errors before it works - mostly due to malformed html from the exporter or the original page, fix these e.g.
- Missing start
- Missing end