# संपत्ति संपीड़न और छोटा करना — वेब प्रदर्शन अनुकूलन

Source: https://www.geekswithgeeks.com/hi/web-performance/web-perf-05

> CSS, JavaScript और HTML को संपीड़ित और छोटा करके फ़ाइल आकार को कम करें।

## Gzip और Brotli संपीड़न

Enable **gzip** (browser support ~99%) or **Brotli** (15-20% better compression). Both are transport-level: add `Content-Encoding: gzip` header. Typical reduction: 70-80% for text assets.

## छोटा करने के उपकरण

Use **Terser** (JavaScript), **CSSNano** (CSS), **HTMLMinifier**. Remove comments, whitespace, unused code. Build tools like Webpack, Vite do this automatically. Typical reduction: 30-50%.

## ट्री-शेकिंग और अप्रयुक्त कोड हटाना

Modern bundlers analyze ES6 imports to eliminate dead code. Mark packages as `sideEffects: false` in package.json. Reduce bundle size by removing truly unused dependencies and code paths.

## संपीड़न सर्वोत्तम प्रथाएं

Always enable compression on server. Prefer Brotli for static assets, gzip for dynamic. Test compression ratio. Small assets (<1KB) may not benefit from compression due to overhead.

त्वरित जाँच

**Quiz:** gzip के साथ विशिष्ट संपीड़न में कमी क्या है?

- [ ] टेक्स्ट संपत्ति के लिए 70-80%
- [ ] टेक्स्ट संपत्ति के लिए 10-20%
- [ ] टेक्स्ट के लिए संपीड़न काम नहीं करता है
