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.
.uzcss
files across directories using glob patterns.Follow these steps to set up and run the UZCSS compiler in your project.
Clone the repository:
git clone https://github.com/usmonovshohruxmirzo/uzcss.git
cd uzcss
Install dependencies:
npm install
# or
yarn install
This will install chalk
, fast-glob
, and fs-extra
which are required by the compiler.
The UZCSS compiler is designed to be run via a script in your package.json
.
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
}
"styles/**/*.uzcss"
: This is the input glob pattern. It tells the compiler to look for all files ending with .uzcss
inside the styles
directory and any of its subdirectories."dist"
: This is the output directory where the compiled .css
files will be saved. The compiler will mirror the input directory structure within dist
..uzcss
filesPlace 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;
}
Execute the uzcss
script from your terminal in the projectβs root directory:
npm run uzcss
# or
yarn uzcss
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;
}
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
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
};
properties
: An object where keys are Uzbek CSS property names and values are their standard English CSS equivalents.values
: An object where keys are Uzbek CSS value names and values are their standard English CSS equivalents.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.
git checkout -b feature/your-feature-name
).git commit -m 'feat: Add new feature'
).git push origin feature/your-feature-name
).This project is licensed under the ISC License - see the LICENSE file for details.
If you have any questions or need assistance, please open an issue in the GitHub repository.