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

Split fit-html.ts into another npm package for writing light sharable web components. #26

Closed
harryfei opened this issue Jul 18, 2018 · 8 comments

Comments

@harryfei
Copy link

harryfei commented Jul 18, 2018

We can use fit-html's awesome withFit function to write shared web components without any redux dependency after doing this.

@harryfei harryfei changed the title Could you split fit-html.tx into another npm package? Split fit-html.tx into another npm package for writing light sharable web components. Jul 18, 2018
@harryfei harryfei changed the title Split fit-html.tx into another npm package for writing light sharable web components. Split fit-html.ts into another npm package for writing light sharable web components. Jul 18, 2018
@NeoLegends
Copy link
Member

NeoLegends commented Jul 18, 2018

Splitting off a separate package shouldn't be necessary for this. Just importing the withFit-mixin directly will be enough. :)

We never import redux directly in any of the mixins (just the TS types) nvm I forgot bindActionCreators, but that's in connect, not in withFit. :)

@harryfei
Copy link
Author

Ok, I got it. That's cool.

@harryfei
Copy link
Author

harryfei commented Jul 19, 2018

BTW, is 3Kb still correct now? I just get a 20Kb bundle file(fit-html, lit-html, and redux) and an 8Kb compressed file. @NeoLegends

@NeoLegends
Copy link
Member

BTW, is 3Kb still correct now? I just get a 20Kb bundle file(fit-html, lit-html, and redux) and an 8Kb compressed file. @NeoLegends

3k was always minzipped size, but that sounds a little large, tbh. fit-html hasn't changed in size very much lately, but lit-html and maybe redux have. How many components are there in your bundle? You may underestimate the size of the template strings. Also, are you using a tree-shaking bundler (webpack 2, rollup)?

@harryfei
Copy link
Author

harryfei commented Jul 19, 2018

Yeah, I check the bundle file, it's not fit-html's fault. lit-html increase a lot during recent versions.

@NeoLegends
Copy link
Member

Great! Mind sharing the stats? I‘d be interested in how large lit-html has become by now. :)

@harryfei
Copy link
Author

I write the index.ts and import lit-html (v0.10), use rollup to build bundle.

import { html } from 'lit-html/lib/lit-extended';
console.log(html)

minized size: 5.2Kb
minized and gizped size: 1.9Kb

@NeoLegends
Copy link
Member

NeoLegends commented Jul 19, 2018

I'm afraid you're missing the render from lit-html to get more accurate stats about the size. Right now you're just importing the tag, but no render functionality.

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