How can i uglifiy my css files like on instagram or facebook?
e.g _8f735
, _oofbn
, _6ltyr
It's some react plugins or something? I saw this only on instagram and facebook.
How can i uglifiy my css files like on instagram or facebook?
e.g _8f735
, _oofbn
, _6ltyr
It's some react plugins or something? I saw this only on instagram and facebook.
Have a look at CSS Modules.
Example from React CSS Modules:
In the context of React, CSS Modules look like this:
import React from 'react'; import styles from './table.css'; export default class Table extends React.Component { render () { return <div className={styles.table}> <div className={styles.row}> <div className={styles.cell}>A0</div> <div className={styles.cell}>B0</div> </div> </div>; } }
Rendering the ponent will produce a markup similar to:
<div class="table__table___32osj"> <div class="table__row___2w27N"> <div class="table__cell___2w27N">A0</div> <div class="table__cell___1oVw5">B0</div> </div> </div>
and a corresponding CSS file that matches those CSS classes.
Important: class names can have different format.
What you want, is probably done by using classname maps.
Currently, you have different options with the class rename already implemented:
If you are searching for a library to do this by yourself, see one of these:
Probably there are some other alternatives out there but for me these are the best ones.
Anyway, keep in mind that in the most cases, this is a unnecessary step that only should be done for pages with a very high network traffic to reduce the bytes sent to the client.