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

Export for usage outside of svelte #3

Closed
milafrerichs opened this issue Dec 21, 2019 · 4 comments
Closed

Export for usage outside of svelte #3

milafrerichs opened this issue Dec 21, 2019 · 4 comments

Comments

@milafrerichs
Copy link

Hey @tanhauhau

thanks for this! Really neat, would you consider adding the ability to export this component to be used outside of svelte?
something like this:

new JsonTree({
	target: document.querySelector('#main'),
	props: {
		value: {
			array: [1, 2, 3],
			bool: true,
			object: {
				foo: 'bar'
			}
		}
	}
});

Would love to use it in my project.
I have already forked it and would have one way of implementing it ready and could provide a PR.

master...milafrerichs:feat/add-package-export

Have a great day and a great Christmas holiday (if you celebrate that :) )

@tanhauhau
Copy link
Owner

published v0.1.0 for this.

@milafrerichs
Copy link
Author

awesome, thanks!
merry Christmas! :)

@milafrerichs
Copy link
Author

@tanhauhau thanks for that
Happy New Year!!

I just tried it out and it unfortunately did not work.

I think it's because you published it only as cjs and this does not work in the browser.
would it be possible to publish as umd as well and give it a name (like JsonTree)

{ file: 'dist/index.js' , 'format': 'umd', name: 'JsonTree' }

similar to what I did in my fork:
master...milafrerichs:feat/add-package-export#diff-ff6e5f22a9c7e66987b19c0199636480R15

Thanks a lot.
Have a great day.

@tanhauhau
Copy link
Owner

tanhauhau commented Apr 5, 2022

Sorry for getting back this later, i've published a umd version in 1.0.0.

You can use it in the browser directly like:

<html>
  <script src="https://unpkg.com/svelte-json-tree@1.0.0/dist/standalone/umd/index.js"></script>
  <script>
    new SvelteJsonTree({
      target: document.body,
      props: { value: [20, 21] },
    });
  </script>
</html>

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

2 participants