DEV Community

Discussion on: 3 reasons why I went framework agnostic and why you should do that too

Collapse
 
stefannieuwenhuis profile image
Stefan Nieuwenhuis

I haven't worked with Svelte intensively, but I hear great stories about it. Must take it for a spin soon.

Collapse
 
andrewdc profile image
Andrew Colclough

Yeah, I highly recommend it. We have it setup so that we can build components, and dump them out as simple JS packages.

Something like this is all our teams need to do to consume one:

    const yourComponent = new yourComponent({
      target: document.getElementById('someElementID'),
      props: {
        propKey: propVal,
        themeBackground: "#ffffff",
        themeicon: "#989999",
      },
    });

We have sorted out passing in theming, data API details, and also dumping out bundles that work in IE11.

It was a little trial and error, as everything is new, but it's been more than worth it, because Svelte is so nice to work with.

It's worth a look. (Actually, I should write a post about all the little odds and ends we sorted out to get this thing flying. Might be helpful for others.)

Thread Thread
 
stefannieuwenhuis profile image
Stefan Nieuwenhuis

That looks so awesome! That you even made it work with IE11 is really cool. What about polyfills? And do you have a link to a GIT repo or something?

Thread Thread
 
andrewdc profile image
Andrew Colclough

ok, ....Clearly I need to write about this. HAHAHA!

Yes, we got things working in IE11. We use babel for shims and polyfills, and we happened to be using fetch which requires a separate polyfill. The downside is that this took a 20k bundle, and bloated it up to about 103k. I kinda hate that, so I am currently R&Ding how to deliver a big fatty IE11 bundle, and a nice sleek bundle for everyone else.

You have inspired me to write a big summation post, with links to resources. To solve all these challenges I was on a wild goose chase across the interwebs, and if I can help anyone else avoid that, I would be happy. lol.

I don't have a repo I can share, as this is internal, but I will create something to share soon.

Thread Thread
 
stefannieuwenhuis profile image
Stefan Nieuwenhuis

I totally understand that you cannot share an internal repo. I have the same problem as well...I feel blessed that I've inspired you to write your own post. I can't wait to read it!

Please share it once it's ready :)

Thread Thread
 
andrewdc profile image
Andrew Colclough

Totally will!

In the mean time, here's just some silly thing I have been playing with to test out Svelte concepts.

svelte.dev/repl/32f9c97b2c4f4da0a4...

I'm also using this to teach my oldest (7yrs) about programming. ;) But it's so nice to work with. Svelte gets a ton of overhead out of the way.