Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9
📝 Rename css classes and id's in files
License
JPeer264/node-rename-css-selectors
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Note: Please make sure your files are not minified/uglified. Do that after processing it with
rename-css-selectors
This module renames all CSS selectors in the given files. It will collect all selectors from the given CSS files. Do not worry about your selectors,rcs
will do it for you.
You can also use a config file with the combination ofgenerateMapping andloadMapping, if you already had other projects with the same classes. So all your projects have the same minified selector names - always.
This is a plugin ofrcs-core
npm i rename-css-selectors rcs-core
or
yarn add rename-css-selectors rcs-core
Async:
There are 3 different ways of writing async
rcs
code: callbacks, promises and async/await
// you can use every method of `rcs-core` on topconstrcsCore=require('rcs-core');constrcs=require('rename-css-selectors')// if you want to include the .rcsrc configrcs.config.load();// if you have some generated mappings - load them!// you can also specify the string although it does not exist yet.rcs.mapping.load('./renaming_map.json');// now with rcsCore you could e.g. ignore single variables (optional)rcsCore.baseLibrary.setExclude(/<%=[\s\S]+%>/);// callbackrcs.process.auto(['**/*.js','**/*.html','**/*.css'],options,(err)=>{// all css files are now saved, renamed and stored in the selectorLibrary// also other files are not renamed// that's it// maybe you want to add the new selectors to your previous generated mappings// do not worry, your old settings are still here, in case you used `rcs.mapping.load`rcs.mapping.generate('./',{overwrite:true},(err)=>{// the mapping file is now saved});});// promisercs.process.auto(['**/*.js','**/*.html','**/*.css'],options).then(()=>rcs.mapping.generate('./',{overwrite:true})).catch(console.error);// async/await(async()=>{try{awaitrcs.process.auto(['**/*.js','**/*.html','**/*.css'],options);awaitrcs.mapping.generate('./',{overwrite:true});}catch(err){console.error(err);}})();
Sync:
constrcs=require('rename-css-selectors');rcs.mapping.load('./renaming_map.json');try{rcs.process.autoSync(['**/*.js','**/*.html','**/*.css'],options);rcs.mapping.generateSync('./',{overwrite:true});}catch(err){console.error(err);}
- rcs.process.auto
- rcs.process.css
- rcs.process.js
- rcs.process.html
- rcs.process.pug
- rcs.process.any
- rcs.mapping
- rcs.config
Correctly usingrename-css-selectors
on large project means few rules should be followed.This document explains most of them.
MIT ©Jan Peer Stöcklmair
About
📝 Rename css classes and id's in files
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.