{"id":20395411,"url":"https://github.com/jpeer264/node-rcs-core","last_synced_at":"2025-04-12T12:24:37.055Z","repository":{"id":47904510,"uuid":"72679121","full_name":"JPeer264/node-rcs-core","owner":"JPeer264","description":"Rename css selectors across all files","archived":false,"fork":false,"pushed_at":"2022-03-16T18:59:09.000Z","size":2443,"stargazers_count":37,"open_issues_count":5,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T20:55:38.216Z","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},"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-11-02T20:35:45.000Z","updated_at":"2024-01-02T04:27:27.000Z","dependencies_parsed_at":"2022-09-21T10:50:52.314Z","dependency_job_id":null,"html_url":"https://github.com/JPeer264/node-rcs-core","commit_stats":null,"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rcs-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rcs-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rcs-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-rcs-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JPeer264","download_url":"https://codeload.github.com/JPeer264/node-rcs-core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565642,"owners_count":21125534,"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:25.437Z","updated_at":"2025-04-12T12:24:37.032Z","avatar_url":"https://github.com/JPeer264.png","language":"TypeScript","readme":"# rcs-core\n[![Build Status](https://travis-ci.com/JPeer264/node-rcs-core.svg?branch=master)](https://travis-ci.com/JPeer264/node-rcs-core)\n[![Coverage Status](https://coveralls.io/repos/github/JPeer264/node-rcs-core/badge.svg)](https://coveralls.io/github/JPeer264/node-rcs-core)\n\n\u003e **rcs** is short for **rename css selectors**\n\n## Why?\nHaving long CSS selectors, such as `main-menu__item--disabled`, can increase the filesizes. With this `rcs-core` it is easy to rename the selectors and therefore reduce the filesize. You can save around 20% of the filesize by just shorten the CSS selectors in the CSS files.\n\n## What does it do?\nIt basically just rename/minify all CSS selectors in all files. First the library has to be [trained with selectors](docs/api/filllibraries.md). Based on this data, the selectors can be renamed in all files. [Here](examples) are some examples made with [Bootstrap files](http://getbootstrap.com/).\n\nSome live projects:\n- AMP Project ([https://amp.dev/](https://amp.dev/))\n- Analyse ([https://analyse.org/](https://analyse.org/))\n- My personal webpage ([https://jpeer.at/](https://jpeer.at/))\n\n## Caveats\n\nCorrectly using `rcs-core` or any of its [plugins](#plugins) on large project means few rules should be followed.\n\n[This document](docs/caveats.md) explains most of them.\n\n## Installation\n```sh\n$ npm install --save rcs-core\n```\nor\n```sh\n$ yarn add rcs-core\n```\n\n## Usage\n\n\u003e **Note** couple of selectors are [excluded by default](./lib/helpers/excludeList.ts). You can activate them by using `.setInclude` **before** you fill the library\n\n1. Fill your library with all selectors (we assume there is just one CSS file)\n\n```js\n// excluding specific selectors\nrcs.selectorsLibrary.setExclude('selector-to-ignore');\n// include specific selectors which has been ignored by default\nrcs.selectorsLibrary.setInclude('center');\n\nrcs.fillLibraries(fs.readFileSync('./src/styles.css', 'utf8'));\n```\n\n2. Optimize the selectors compression (optional)\n\n```js\nrcs.optimize();\n```\n\n3. Rewrite all files\n\n\u003e **Note:** Do not forget to replace your CSS file\n\n```js\nconst css = rcs.replace.css(fs.readFileSync('./src/styles.css', 'utf8'));\nconst js = rcs.replace.js(fs.readFileSync('./src/App.js', 'utf8'));\nconst html = rcs.replace.html(fs.readFileSync('./src/index.html', 'utf8'));\n\n// output some warnings which has been stacked through the process\nrcs.warnings.warn();\n\nfs.writeFileSync('./dist/styles.css', css);\nfs.writeFileSync('./dist/App.js', js);\nfs.writeFileSync('./dist/index.html', html);\n```\n\n## API documentation\n- [rcs.stats](docs/api/stats.md) (deprecated)\n- [rcs.replace](docs/api/replace.md)\n- [rcs.mapping](docs/api/mapping.md)\n- [rcs.optimize](docs/api/optimize.md)\n- [rcs.statistics](docs/api/statistics.md)\n- [rcs.baseLibrary](docs/api/baselibrary.md)\n- [rcs.fillLibraries](docs/api/filllibraries.md)\n- [rcs.nameGenerator](docs/api/namegenerator.md)\n- [rcs.selectorsLibrary](docs/api/selectorslibrary.md)\n- [rcs.keyframesLibrary](docs/api/keyframeslibrary.md)\n- [rcs.cssVariablesLibrary](docs/api/cssvariableslibrary.md)\n- [rcs.useCustomGenerator](docs/api/usecustomgenerator.md)\n\n## Plugins\n- Node Plugin: [rename-css-selectors](https://www.npmjs.com/package/rename-css-selectors)\n- Parcel Plugin: [parcel-plugin-rcs](https://www.npmjs.com/package/parcel-plugin-rcs)\n- Webpack Plugin: [rcs-webpack-plugin](https://www.npmjs.com/package/rcs-webpack-plugin)\n- PostCSS Plugin: [postcss-rcs](https://www.npmjs.com/package/postcss-rcs)\n- Gulp Plugin: [gulp-rcs](https://www.npmjs.com/package/gulp-rcs)\n- Grunt Plugin: [grunt-rcs](https://www.npmjs.com/package/grunt-rcs)\n","funding_links":["https://patreon.com/jpeer"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-rcs-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpeer264%2Fnode-rcs-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-rcs-core/lists"}