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

[Question] Small and custom release build #549

Open
lonix1 opened this issue Sep 26, 2022 · 3 comments
Open

[Question] Small and custom release build #549

lonix1 opened this issue Sep 26, 2022 · 3 comments

Comments

@lonix1
Copy link

lonix1 commented Sep 26, 2022

Hope someone has had this use case too...

I'm using this library because I'm familiar with bootstrap, and for theming we use a different library (fast) so the app has a specific look. So I want to use this library for grids, rows, cols, spacing, etc., and the other library for components.

If I were using js+css directly I'd just create a custom build of bootstrap with only the basics: layout, grid, etc. But here I'm unsure. There are release-build linking and tree shaking concerns, custom css, and who knows what else.

Has someone done this before? Any pointers to share to ensure my build is as small as possible - both the dll and the css?

@lonix1 lonix1 changed the title Small and custom release build [Question] Small and custom release build Sep 26, 2022
@jbomhold3
Copy link
Collaborator

Blazor has an option built in for trimming. Honestly not sure how it's going to affect the library when you use it. I have not had the need to use myself. https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/configure-trimmer?view=aspnetcore-6.0 . I don't know if it will trim down other libraries or just your code and the core you would have to play with it. If it's not auto-trimming the package, you could clone the library, then it will treat it like your native code, and it should trim out anything not used. Will leave this open to someone who uses it and can give a more detailed answer.

@lonix1
Copy link
Author

lonix1 commented Sep 26, 2022

Those are some interesting ideas, thanks. If I find a solution I'll post a follow-up here.

I thought the tree shaking / trimming applied to all code, but you're probably right in that it only applies to my code and not to package references. I wonder whether producing a single-file output would change that, I'll look into that.

At some point it might be nice to have two versions: the full blazorstrap library with 1:1 correspondence to bootstrap, and a "slim" library which excludes the components (similar to how it's done for jquery). If I find a way to do that I'll send a PR, but not promising anything as I'm unfamiliar with this codebase right now.

@jbomhold3
Copy link
Collaborator

Sorry didn't mean to imply it didn't I'm not sure what it does exactly, is all I mean. As I haven't used it myself. It use to mess up Signal R so clearly it does packages too. Just tested it since 3.1.

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