Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just using it... #31

Open
IBIT-ZEE opened this issue Aug 17, 2022 · 4 comments
Open

Just using it... #31

IBIT-ZEE opened this issue Aug 17, 2022 · 4 comments

Comments

@IBIT-ZEE
Copy link

How about an example/video on how to use it without npm...

@Oskar1504
Copy link

Oskar1504 commented Aug 17, 2022

Insert in your <head></head>

<script defer type="module">
    import flamethrower from '/flamethrower.js';
    flamethrower({ log: true, pageTransitions: true });
</script>

Use <a href="/test"></a> elements as always.
Should work

@will-abule
Copy link

will-abule commented Aug 18, 2022

Insert in your <head></head>

<script defer type="module">
    import flamethrower from '/flamethrower.js';
    flamethrower({ log: true, pageTransitions: true });
</script>

Use <a href="/test"></a> elements as always. Should work

just a little addition clone it and run npm run build to generate the main.js bundle, then use it in a module script.

@ekwoka
Copy link
Contributor

ekwoka commented Aug 18, 2022

Or even use

<script type="module">
  import flamethrower from 'https://esm.sh/v90/flamethrower-router'
  flamethrower({ log: true, pageTransitions: true });
</script>

To use an ESM cdn to play around with.

@Oskar1504 Just a tip: type="module" is automatically deferred. Technically you can have async modules but not blocking modules, so defer is default.

@DarrenSem
Copy link

DarrenSem commented Aug 12, 2023

How about an example/video on how to use it without npm...

@IBIT-ZEE
Below examples use import AKA they presume ES6 modules.

You could also include from unpkg, since Jeff published this to npm:

<script href="https://unpkg.com/[email protected]/dist/main.umd.cjs">

URL found via the ending-slash trick:
https://unpkg.com/flamethrower-router/

NOTE: I haven't tried this yet, but it seems to use the standard Universal Module Definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants