uzcss

uzcss logo

uzCSS Lang - Write CSS in Native Uzbek, Compile to Standard CSS

A custom CSS preprocessor that allows developers to write CSS using Uzbek property and value names, which are then compiled into standard English CSS. This project aims to make web styling more accessible and intuitive for Uzbek-speaking developers.


🌟 Features


πŸš€ Getting Started

Follow these steps to set up and run the UZCSS compiler in your project.

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/usmonovshohruxmirzo/uzcss.git
    cd uzcss
    
  2. Install dependencies:

    npm install
    # or
    yarn install
    

    This will install chalk, fast-glob, and fs-extra which are required by the compiler.


πŸ’‘ Usage

The UZCSS compiler is designed to be run via a script in your package.json.

1. Configure package.json

Add the following script to the "scripts" section of your package.json file. Ensure you also have "type": "module" if you are using ES Modules (which index.mjs does).

{
  "scripts": {
    "uzcss": "node src/index.mjs \"styles/**/*.uzcss\" \"dist\""
  },
  "type": "module" // Make sure this line is present at the top level
}

2. Create your .uzcss files

Place your Uzbek CSS files in the styles directory (or any subdirectory within it).

Example: styles/main.uzcss

body {
  rang: qora;
  orqa-fon-rangi: qizil;
  matn-holat: markaz;
  shrft-o`lchami: 16px;
  kenglik: 500px;
  ichki-bo`shliq: 100px;
  chegaralar: 10px;
  balandlik: 500px;
}

header {
  kenglik: 10rem;
  balandlik: 500px;
}

3. Run the compiler

Execute the uzcss script from your terminal in the project’s root directory:

npm run uzcss
# or
yarn uzcss

4. Check the output

After running the command, you will find the compiled .css files in your specified output directory (e.g., dist/styles/main.css).

Example: dist/styles/main.css (generated from styles/main.uzcss)

body {
  color: black;
  background-color: red;
  text-align: center;
  font-size: 16px;
  width: 500px;
  padding: 100px;
  margin: 10px;
  height: 500px;
}

header {
  width: 10rem;
  height: 500px;
}

πŸ“‚ Project Structure

uzcss/
β”œβ”€β”€ src/
β”‚   └── index.mjs             # The main compiler script
β”œβ”€β”€ config/
β”‚   └── uzcss.config.mjs      # Translation maps (Uzbek to English)
β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ main.uzcss            # Example UZCSS file
β”‚   └── components/
β”‚       └── button.uzcss      # Example UZCSS file in a subdirectory
β”œβ”€β”€ dist/                     # Output directory for compiled CSS (created automatically)
β”œβ”€β”€ package.json              # Project dependencies and scripts
└── README.md                 # This documentation file

βš™οΈ Configuration

The core of the translation logic resides in config/uzcss.config.mjs. You can customize or extend the translation mappings here.

config/uzcss.config.mjs

export const properties = {
  rang: "color",
  "fon-rang": "background-color",
  kenglik: "width",
  balandlik: "height",
  // ... add more Uzbek property names and their English equivalents
};

export const values = {
  chap: "left",
  "o`ng": "right",
  markaz: "center",
  qizil: "red",
  "ko`k": "blue",
  // ... add more Uzbek value names and their English equivalents
};

🀝 Contributing

Contributions are welcome! If you have suggestions for new Uzbek terms, improvements to the compiler, or bug fixes, please feel free to open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes.
  4. Commit your changes (git commit -m 'feat: Add new feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Open a Pull Request.

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.


❓ Support and Contact

If you have any questions or need assistance, please open an issue in the GitHub repository.