Code Monkey home page Code Monkey logo

classmapper's Introduction

CSS Mapper

A simple utility to bulk replace/rename CSS class names from a JSON map.

How it works

The lexer indexes all files within the given folder hierarchy and parses them with a combination of css-selector-parser and postcss-safe-parser. It then compares all the individual selectors with their counterpart in the map.json diff, and updates old selectors respectively.

Limitations

The selector parsing library used does not properly parse everything perfectly. some pseudoclasses arent parsed properly and the old classes will remain. You should always diff the converted files and search for outliers and you will need to manually update these outliers from old to new classname.

Prerequisites

Usage

Locally

git clone https://github.com/shdwmtr/cssmapper.git
cd cssmapper
npm install
node lexer ${PATH_TO_THEME}
  • PATH_TO_THEME represents a recursively indexed folder on disk that contains x amount of CSS files.

Using GitHub Actions

  1. In your GitHub repository containing your CSS files, create a new branch. this branch will hold your converted CSS files.
  2. Go to the branch and create .github/workflows/node.js.yml as a new file.
  3. Copy and paste the contents of workflows/lexer.yml to it and commit.
  4. Wait for the workflow to push the changes.
  5. Assuming you've checked limitations and everything is correct, merge the created branch with your main branch.

classmapper's People

Contributors

shdwmtr avatar rosetheflower avatar

Stargazers

 avatar Grafaffel avatar BossSloth avatar  avatar  avatar  avatar Preshyon avatar  avatar Juan avatar SpaceEnergy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.