File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1348,6 +1348,47 @@ import styles from 'Component.module.scss';
1348
1348
ctx .fillStyle = ` ${ svars .colorBackgroundCanvas } ` ;
1349
1349
```
1350
1350
1351
+ ### Plugin: One Letter CSS (with hash length check)
1352
+
1353
+ For efficient gzip/br compression, plugin combine css hash via one symbol name,
1354
+ as a classname position at file, with filepath ` hash:base64:8 ` , to have strong sequences
1355
+
1356
+ ** webpack.config.js**
1357
+
1358
+ ``` js
1359
+ const { OneLetterCss } = require (' css-loader/plugins' );
1360
+ const MyOneLetterCss = new OneLetterCss ();
1361
+
1362
+ const cssHashLen = 8 ;
1363
+
1364
+ module .exports = {
1365
+ module: {
1366
+ rules: [
1367
+ {
1368
+ test: / \. css$ / i ,
1369
+ loader: ' css-loader' ,
1370
+ options: {
1371
+ modules: {
1372
+ mode: ' local' ,
1373
+ localIdentName: ` [hash:base64:${ cssHashLen} ]` ,
1374
+ // for develop
1375
+ // localIdentName: `[local]__[hash:base64:${cssHashLen}]`,
1376
+ getLocalIdent: MyOneLetterCss .getLocalIdent ,
1377
+ },
1378
+ },
1379
+ },
1380
+ ],
1381
+ },
1382
+ plugins: [
1383
+ ... plugins,
1384
+ new HashLenSuggest ({
1385
+ instance: MyOneLetterCss,
1386
+ selectedHashLen: cssHashLen,
1387
+ }),
1388
+ ],
1389
+ };
1390
+ ```
1391
+
1351
1392
## Contributing
1352
1393
1353
1394
Please take a moment to read our contributing guidelines if you haven't yet done so.
You can’t perform that action at this time.
0 commit comments