{"id":20395403,"url":"https://github.com/jpeer264/node-rename-css-selectors","last_synced_at":"2025-04-12T12:24:45.412Z","repository":{"id":12186182,"uuid":"71185259","full_name":"JPeer264/node-rename-css-selectors","owner":"JPeer264","description":"📝  Rename css classes and id's in files","archived":false,"fork":false,"pushed_at":"2023-03-04T06:03:28.000Z","size":1293,"stargazers_count":66,"open_issues_count":11,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T11:05:02.823Z","etag":null,"topics":["css","css-selector","matches-selector","minified-selectors","rcs","rename"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JPeer264.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":null,"patreon":"jpeer","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-10-17T22:06:04.000Z","updated_at":"2024-09-26T21:17:36.000Z","dependencies_parsed_at":"2024-02-04T21:08:10.611Z","dependency_job_id":"b69f3042-ffd0-4195-b632-cfbe617fccba","html_url":"https://github.com/JPeer264/node-rename-css-selectors","commit_stats":null,"previous_names":["jpeer264/rename-css-selectors"],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rename-css-selectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rename-css-selectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rename-css-selectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rename-css-selectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JPeer264","download_url":"https://codeload.github.com/JPeer264/node-rename-css-selectors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565662,"owners_count":21125536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","css-selector","matches-selector","minified-selectors","rcs","rename"],"created_at":"2024-11-15T03:57:23.409Z","updated_at":"2025-04-12T12:24:45.376Z","avatar_url":"https://github.com/JPeer264.png","language":"TypeScript","funding_links":["https://patreon.com/jpeer"],"categories":[],"sub_categories":[],"readme":"# Rename CSS Selectors (RCS)\n\n[![Build Status](https://travis-ci.org/JPeer264/node-rename-css-selectors.svg?branch=master)](https://travis-ci.org/JPeer264/node-rename-css-selectors)\n[![Coverage Status](https://coveralls.io/repos/github/JPeer264/node-rename-css-selectors/badge.svg?branch=master)](https://coveralls.io/github/JPeer264/node-rename-css-selectors?branch=master)\n\n\u003e **Note:** Please make sure your files are not minified/uglified. Do that after processing it with `rename-css-selectors`\n\nThis 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.\n\nYou can also use a config file with the combination of [generateMapping](#generateMapping) and [loadMapping](#loadMapping), if you already had other projects with the same classes. So all your projects have the same minified selector names - always.\n\nThis is a plugin of [rcs-core](https://github.com/JPeer264/node-rcs-core)\n\n## Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Methods](#methods)\n- [Caveats](#caveats)\n- [LICENSE](#license)\n\n## Installation\n\nInstall with [npm](https://docs.npmjs.com/cli/install) or [yarn](https://yarnpkg.com/en/docs/install)\n\n```sh\nnpm i rename-css-selectors rcs-core\n```\nor\n```sh\nyarn add rename-css-selectors rcs-core\n```\n\n## Usage\n\nAsync:\n\n\u003e There are 3 different ways of writing async `rcs` code: callbacks, promises and async/await\n\n```js\n// you can use every method of `rcs-core` on top\nconst rcsCore = require('rcs-core');\nconst rcs = require('rename-css-selectors')\n\n// if you want to include the .rcsrc config\nrcs.config.load();\n\n// if you have some generated mappings - load them!\n// you can also specify the string although it does not exist yet.\nrcs.mapping.load('./renaming_map.json');\n\n// now with rcsCore you could e.g. ignore single variables (optional)\nrcsCore.baseLibrary.setExclude(/\u003c%=[\\s\\S]+%\u003e/);\n\n// callback\nrcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options, (err) =\u003e {\n    // all css files are now saved, renamed and stored in the selectorLibrary\n    // also other files are not renamed\n    // that's it\n\n    // maybe you want to add the new selectors to your previous generated mappings\n    // do not worry, your old settings are still here, in case you used `rcs.mapping.load`\n    rcs.mapping.generate('./', { overwrite: true }, (err) =\u003e {\n        // the mapping file is now saved\n    });\n});\n\n// promise\nrcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options)\n    .then(() =\u003e rcs.mapping.generate('./', { overwrite: true }))\n    .catch(console.error);\n\n// async/await\n(async () =\u003e {\n    try {\n        await rcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options);\n        await rcs.mapping.generate('./', { overwrite: true });\n    } catch (err) {\n        console.error(err);\n    }\n})();\n```\n\nSync:\n\n```js\nconst rcs = require('rename-css-selectors');\n\nrcs.mapping.load('./renaming_map.json');\n\ntry {\n    rcs.process.autoSync(['**/*.js', '**/*.html', '**/*.css'], options);\n    rcs.mapping.generateSync('./', { overwrite: true });\n} catch (err) {\n    console.error(err);\n}\n```\n\n## Methods\n\n- [rcs.process.auto](docs/api/processAuto.md)\n- [rcs.process.css](docs/api/processCss.md)\n- [rcs.process.js](docs/api/processJs.md)\n- [rcs.process.html](docs/api/processHtml.md)\n- [rcs.process.pug](docs/api/processPug.md)\n- [rcs.process.any](docs/api/processAny.md)\n- [rcs.mapping](docs/api/mapping.md)\n- [rcs.config](docs/api/config.md)\n\n## Caveats\n\nCorrectly using `rename-css-selectors` on large project means few rules should be followed.\n[This document](https://github.com/JPeer264/node-rcs-core/blob/main/docs/caveats.md) explains most of them.\n\n# LICENSE\n\nMIT © [Jan Peer Stöcklmair](https://www.jpeer.at)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-rename-css-selectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpeer264%2Fnode-rename-css-selectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-rename-css-selectors/lists"}