Closed lonix1 closed 2 days ago
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.
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.
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.
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?