Does Ant Design Library size effect website performance? - javascript

Does Ant Design Library size effect website performance? or adding lot of libraries in react will effect website speed ?
while looking on Ant.Design library size its showing 49MB , means while installing the antd libraries entire components are installing i guess.
if am importing only table component from antd does this loads whole library ?
Does this library size will effect the website in any ways?
Is there any possibility to install the needed components separately?
i have found a section in antd documentation , its showing below
what does its means? only the components we imported only gets bundles in the build?
Finlay one more question if i installed a library and not used it in the code does this library will be get bundled in the build?

First question, Huge library size it will affect website performance, but tree-shaking can solve this problem. And Ant Design support tree-shaking.
If you import only table component from antd, it will not load the whole library
Yes, because if the website is too large, it will take a long time for users to load. You can use tree-shaking solve this problem.
import { Button } from 'antd';
It is only install Button Component code to your bundled, not all antd component.
Tree Shaking,
Code Splitting There are two good solutions when it comes to website size problem.

Related

Tailwind component library installed on Tailwind Website project experiencing class collision

So, I've created a component library in React.js using Typescript. I'm using Tailwind CSS on this component library. I've published the component library on npm and then installed it on a website that I'm building. I'm trying to use Tailwind on my website as well. The problem is that when I apply Tailwind to the website and use the components, it is applying Tailwind to the component library a second time. Tailwind was already applied once to the component library when I built it. Now it is applying it a second time, and it's screwing things up like my sizing breakpoints. Here's an example of it being double applied to a component in my component library: See Here. How do I get Tailwind to ignore and not apply itself to my component library?
My initial idea was to see if there was a way to modify the css class names on build, but I haven't found any information on how to do that. Any ideas on how to fix this are appreciated.
it would be best if you had a prefix set up in your website tailwind config to avoid collision between your components library and website.

Can I use libraries like "Tilt.js" on Vue?

I'm building an app using Vue(Nuxt) and Tailwind. I have a component which is named "game container" and I want this component to have on hover tilt effect. So, after a little search, I found the Tilt.js library and wanted to use it. But didn't find anything about its implementation. So, is it possible to use Tilt.js on Vue, if it's possible how?

Bootstrap into already existing html/css site

I already have html/css website. Is it possible to insert bootstrap into it and use it only for some features , for example making this website responsive on all devices etc?
Not really.
Bootstrap sets CSS properties on many elements. Simply adding it will create a great many side effects.
Its effects are not limited to elements that you specify.
It also won't magically make things responsible. The responsive features in it require specific HTML structures which you won't have.
If you want to make an existing site responsive, you are best off writing your own media queries.
If you just want the responsive helper utilities and the grid, then you can import the grid only, so that bootstrap styles don't clash with you own existing styles.
So instead of importing bootstrap.css you just import bootstrap-grid.css.
If you use SCSS compiler you can do the same thing just with the .scss extension.
https://getbootstrap.com/docs/5.1/getting-started/contents/#css-files

How to build stackable cards in React with react-swipe-card?

I'm looking to build a UI with stackable cards, something like:
Where there are a dynamic number of cards being the currently active card, and as the top card goes away, cards below is displayed. Very similar to Tinder's swipe-able experience.
I need to build this UI Component in my React web-app (not native). I found this library which looks very popular:
https://github.com/oliviertassinari/react-swipeable-views
However this library does not appear to support stacking view, and showing all the views at an offset as seen below.
Does anyone know if it is possible to accomplish what I'm looking for with react-swipeable-views or if there is a better library out there to accomplish UIC as seen in the image?
You could use the react-spring library to achieve this. Here is an example of that behavior implemented.
I hope it helps you!

Can Bootstrap (4) be integrated along with Angular Material (2)?

I'd like to use Angular Material 2 library, because of its (growing list of) components. But i'm used to bootstrap and it's goodies like responsive utilities and lightweight UI for typical things. By Bootstrap I mostly mean its CSS part, I almost never need its JS functionality.
For example in Material lilbrary there is practically zero styling for list group, while Bootstrap gives that with its css.
I remember reading that combining them is not a good idea, mainly because their global app-wide styles will collide. I can't find that source and I'm curios - is that true with current versions? If so, exactly what is conflicting and how can it be worked around?
Since Bootstrap is modular, one alternative approach could be using Angular Material and then just picking from Bootstrap only the parts that you really need.
Note: whatever you're going to import, you should install bootstrap first:
npm install bootstrap --save
And import the required sass file inside your global style.scss:
// Imports functions, variables, and mixins that are needed by other Bootstrap files
#import "~bootstrap/scss/functions";
#import "~bootstrap/scss/variables";
#import "~bootstrap/scss/mixins";
For example, you might want to use Bootstrap Reboot in order to make all browsers render the elements more consistently and following the web standards.
Then you only need to import:
// Import Roboot
#import "~bootstrap/scss/reboot";
You probably want to make use of the Bootstrap Grid System as well, in such case you can further add:
#import "~bootstrap/scss/grid"; // add the grid
So you would be able to use it in your html templates:
<div class="container">
<div class="row">
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
<div class="col">
One of three columns
</div>
</div>
</div>
You may also want to use the Bootstrap Utilities, in such case add also:
#import "~bootstrap/scss/utilities"; // add css utilities
My answer is based on what's explained here in details: https://www.amadousall.com/the-good-parts-of-bootstrap-4-you-are-missing-in-your-angular-material-projects/
Angular Material 2 is a new library still in active development so you should not expect many fancy nice to have features in that, yet, but on the long run you will have a lots of benefits using Material 2 in you angular app. Here is some overview:
Component Development Kit
In the last releases Material 2 team introduced #angular/cdk which is a core for Material 2 and also gives developers a great ground to write their own thirdparty components. There is no much docs on #angular/cdk yet, but you can track that issue https://github.com/angular/material2/issues/2789 to keep updated on that matter.
Responsive goddies
There is no builtin functionality in Material 2 that gives you responsive goddies. For that matter you have to use #angular/flex-layout thing is completely separate from Material 2 - basically it is a nice abstraction on top of Flexbox CSS. Using that you do not have to write whole bunch of responsive css mediaQueries yourself.
Browsers support
Material 2: IE11+
Bootstrap 4 IE10+
Bootstrap 3 IE8+
Bootstrap + Material ?
It is up to you if you want to combine both Frameworks in your app. If you do that check the bundle size to make sure it is not bloated.
While Kuncevic's answer is right, I think we should also add the following:
Angular Material is implicitly upgrading/downgrading DOM elements
while Bootstrap is not. That means that in Bootstrap, you get what
you see, while in Angular Material, some elements are automatically
rendered. So, I can't really see how you can combine the two, even if
you want to. Adding, Angular's view encapsulation in the mix, things
get even messier.
The only part where I see room for cooperation is in the grid. You
could use Bootstrap for the grid and Angular Material for the rest, but with Angular Flex
Layout (as Kunsevic already mentioned) you don't really need to.
There is a small learning curve there, but it is worth it, if you use
Angular.
Bootstrap's CSS does conflict with Angular Material's CSS. When used
together I have noticed that certain elements like icons inside
floating buttons are not centered correctly, etc. This shouldn't be a
difficult fix, but why bother when you can use Angular Flex?
Hope that helps.
In 2019 Angular conference they explained is it ok or not combining bootstrap and angular material.
https://www.youtube.com/watch?v=xLj1qw82oAo&feature=youtu.be

Categories