├── .gitignore ├── CHANGELOG.md ├── .npmignore ├── .travis.yml ├── postcss-tatar-stylesheets.png ├── .editorconfig ├── .jshintrc ├── test.js ├── package.json ├── README.md ├── LICENSE-MIT ├── list.md └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | * Initial release. 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .editorconfig 2 | .gitignore 3 | .jshintrc 4 | .travis.yml 5 | test.js 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - stable 5 | - "4" 6 | - "0.12" 7 | -------------------------------------------------------------------------------- /postcss-tatar-stylesheets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azat-io/postcss-tatar-stylesheets/HEAD/postcss-tatar-stylesheets.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "expr": true, 5 | "immed": true, 6 | "latedef": true, 7 | "noarg": true, 8 | "node": true, 9 | "noempty": true, 10 | "strict": true, 11 | "trailing": true, 12 | "undef": true, 13 | "unused": true 14 | } 15 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import postcss from 'postcss'; 2 | import test from 'ava'; 3 | 4 | import plugin from './'; 5 | 6 | function run(t, input, output, opts = { }) { 7 | return postcss([ plugin(opts) ]).process(input) 8 | .then( result => { 9 | t.same(result.css, output); 10 | t.same(result.warnings().length, 0); 11 | }); 12 | } 13 | 14 | test('Do something', t => { 15 | return run(t, 'div { фон: кызгылт-сары; калкавыч: уң; тышкыара: 30px 20px; өске-эчке-ара: 40px; блокның-дәрәҗәсе: 1 }', 'div { background: orange; float: right; margin: 30px 20px; padding-top: 40px; z-index: 1 }', { }); 16 | }); 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postcss-tatar-stylesheets", 3 | "version": "1.0.0", 4 | "description": "PostCSS plugin for writing Tatar Style Sheets", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "ava && eslint test.js" 8 | }, 9 | "keywords": [ 10 | "css", 11 | "postcss", 12 | "postcss-plugin", 13 | "tatarstan", 14 | "tatar", 15 | "tatar-stylesheets" 16 | ], 17 | "license": "MIT", 18 | "devDependencies": { 19 | "ava": "^0.12.0", 20 | "eslint": "^2.2.0" 21 | }, 22 | "homepage": "https://github.com/azat-io/postcss-tatar-stylesheets", 23 | "author": { 24 | "name": "Azat S.", 25 | "email": "to@azat.io", 26 | "url": "https://github.com/azat-io/postcss-tatar-stylesheets" 27 | }, 28 | "repository": "azat-io/postcss-tatar-stylesheets", 29 | "dependencies": { 30 | "lodash": "^4.1.0", 31 | "postcss": "^5.0.10" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # postcss-tatar-stylesheets 2 | 3 | [![Build Status](https://travis-ci.org/azat-io/postcss-tatar-stylesheets.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-tatar-stylesheets.svg)][npm] [![Dependency Status](https://gemnasium.com/azat-io/postcss-tatar-stylesheets.svg)][deps] 4 | 5 | > PostCSS plugin for writing Tatar Style Sheets 6 | 7 | ## Install 8 | 9 | With [npm](https://npmjs.org/package/postcss-tatar-stylesheets) do: 10 | 11 | ``` 12 | npm install postcss-tatar-stylesheets --save 13 | ``` 14 | 15 | ## Example 16 | 17 | ![](https://github.com/azat-io/postcss-tatar-stylesheets/blob/master/postcss-tatar-stylesheets.png?raw=true) 18 | 19 | [Full list of properties and values](https://github.com/azat-io/postcss-tatar-stylesheets/blob/master/list.md) 20 | 21 | ## License 22 | 23 | MIT © [Azat S.](https://github.com/azat-io/postcss-tatar-stylesheets) 24 | 25 | [ci]: https://travis-ci.org/azat-io/postcss-tatar-stylesheets 26 | [deps]: https://gemnasium.com/azat-io/postcss-tatar-stylesheets 27 | [npm]: http://badge.fury.io/js/postcss-tatar-stylesheets 28 | [postcss]: https://github.com/postcss/postcss 29 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) Azat S. (https://github.com/azat-io/postcss-tatar-stylesheets) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /list.md: -------------------------------------------------------------------------------- 1 | # Full list of Properties and Values 2 | 3 | ## Properties 4 | 5 | ```js 6 | 'animation': 'анимация', 7 | 'animation-delay': 'анимацияне-тоткарлау', 8 | 'background': 'фон', 9 | 'background-color': 'төп-төс', 10 | 'background-image': 'төп-рәсем', 11 | 'background-position': 'фонның-урыны', 12 | 'background-repeat': 'фонның-кабатлануы', 13 | 'border': 'чик', 14 | 'border-bottom': 'аскы-чик', 15 | 'border-bottom-color': 'аскы-чикнең-төсе', 16 | 'border-bottom-style': 'аскы-чикнең-стиле', 17 | 'border-bottom-width': 'аскы-чикнең-иңе', 18 | 'border-color': 'чикнең-төсе', 19 | 'border-left': 'сул-чик', 20 | 'border-left-color': 'сул-чикнең-төсе', 21 | 'border-left-style': 'сул-чикнең-стиле', 22 | 'border-left-width': 'сул-чикнең-иңе', 23 | 'border-right': 'уң-чик', 24 | 'border-right-color': 'уң-чикнең-төсе', 25 | 'border-right-style': 'уң-чикнең-стиле', 26 | 'border-right-width': 'уң-чикнең-иңе', 27 | 'border-style': 'чикнең-стиле', 28 | 'border-top': 'өске-чик', 29 | 'border-top-color': 'өске-чикнең-төсе', 30 | 'border-top-style': 'өске-чикнең-стиле', 31 | 'border-top-width': 'өске-чикнең-иңе', 32 | 'border-width': 'иңнең-чиге', 33 | 'bottom': 'ас', 34 | 'clear': 'чистартырга', 35 | 'clip': 'кыскартырга', 36 | 'color': 'төс', 37 | 'cursor': 'курсор', 38 | 'display': 'чагылыш', 39 | 'filter': 'фильтр', 40 | 'float': 'калкавыч', 41 | 'font': 'минемшрифт', 42 | 'font-family': 'шрифтның-төре', 43 | 'font-size': 'шрифт-зурлыгы', 44 | 'font-style': 'шрифт-стиле', 45 | 'font-weight': 'шрифтның-калынлыгы', 46 | 'height': 'буй', 47 | 'left': 'сул', 48 | 'letter-spacing': 'xәрефләр-арасы', 49 | 'line-height': 'юлның-буе', 50 | 'margin': 'тышкыара', 51 | 'margin-bottom': 'аскы-тышкы-ара', 52 | 'margin-left': 'сул-тышкы-ара', 53 | 'margin-right': 'уң-тышкы-ара', 54 | 'margin-top': 'өске-тышкы-ара', 55 | 'overflow': 'кисергә', 56 | 'padding': 'эчкеара', 57 | 'padding-bottom': 'аскы-эчке-ара', 58 | 'padding-left': 'сул-эчке-ара', 59 | 'padding-right': 'уң-эчке-ара', 60 | 'padding-top': 'өске-эчке-ара', 61 | 'position': 'урыны', 62 | 'right': 'уң', 63 | 'text-align': 'текстны-тигезләү', 64 | 'text-decoration': 'текстны-бизәү', 65 | 'text-indent': 'кызыл-юл', 66 | 'text-shadow': 'текстның-шәүләсе', 67 | 'text-transform': 'текстны-үзгәртү', 68 | 'top': 'өс', 69 | 'visibility': 'күрү-мөмкинлеге', 70 | 'width': 'иң', 71 | 'word-spacing': 'интервал', 72 | 'z-index': 'блокның-дәрәҗәсе' 73 | ``` 74 | 75 | ## Values 76 | 77 | ```js 78 | 'block': 'блок', 79 | 'bold': 'калын', 80 | 'bolder': 'бик-калын', 81 | 'both': 'икеседә', 82 | 'bottom': 'ас', 83 | 'center': 'урта', 84 | 'fixed': 'урында-калдыру', 85 | 'flex': 'флекс', 86 | 'inline': 'бер-юлда', 87 | 'italic': 'курсив', 88 | 'justify': 'иң-буенча', 89 | 'left': 'сул', 90 | 'lighter': 'юка', 91 | 'line-through': 'сызылган', 92 | 'list-item': 'исемлек-элементы', 93 | 'lowercase': 'юл-хәреф', 94 | 'middle': 'үзәктә', 95 | 'no-repeat': 'кабатламаска', 96 | 'none': 'юк', 97 | 'normal': 'стандарт', 98 | 'repeat': 'кабатлау', 99 | 'repeat-x': 'кабатлау-х', 100 | 'repeat-y': 'кабатлау-у', 101 | 'right': 'уң', 102 | 'solid': 'тоташ', 103 | 'top': 'өс', 104 | 'transparent': 'үтә-күренмә', 105 | 'underline': 'ассызыклау', 106 | 'uppercase': 'баш-хәреф' 107 | ``` 108 | 109 | ## Colors 110 | 111 | ```js 112 | 'black': 'кара', 113 | 'blue': 'зәңгәр', 114 | 'brown': 'коңгырт', 115 | 'gold': 'алтын', 116 | 'gray': 'соры', 117 | 'green': 'яшел', 118 | 'orange': 'кызгылт-сары', 119 | 'pink': 'ал', 120 | 'red': 'кызыл', 121 | 'skyblue': 'күк-төсе', 122 | 'white': 'ак', 123 | 'yellow': 'сары' 124 | ``` 125 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var _ = require('lodash'); 2 | var postcss = require('postcss'); 3 | 4 | var mapProperties = { 5 | 'animation': 'анимация', 6 | 'animation-delay': 'анимацияне-тоткарлау', 7 | 'background': 'фон', 8 | 'background-color': 'төп-төс', 9 | 'background-image': 'төп-рәсем', 10 | 'background-position': 'фонның-урыны', 11 | 'background-repeat': 'фонның-кабатлануы', 12 | 'border': 'чик', 13 | 'border-bottom': 'аскы-чик', 14 | 'border-bottom-color': 'аскы-чикнең-төсе', 15 | 'border-bottom-style': 'аскы-чикнең-стиле', 16 | 'border-bottom-width': 'аскы-чикнең-иңе', 17 | 'border-color': 'чикнең-төсе', 18 | 'border-left': 'сул-чик', 19 | 'border-left-color': 'сул-чикнең-төсе', 20 | 'border-left-style': 'сул-чикнең-стиле', 21 | 'border-left-width': 'сул-чикнең-иңе', 22 | 'border-right': 'уң-чик', 23 | 'border-right-color': 'уң-чикнең-төсе', 24 | 'border-right-style': 'уң-чикнең-стиле', 25 | 'border-right-width': 'уң-чикнең-иңе', 26 | 'border-style': 'чикнең-стиле', 27 | 'border-top': 'өске-чик', 28 | 'border-top-color': 'өске-чикнең-төсе', 29 | 'border-top-style': 'өске-чикнең-стиле', 30 | 'border-top-width': 'өске-чикнең-иңе', 31 | 'border-width': 'иңнең-чиге', 32 | 'bottom': 'ас', 33 | 'clear': 'чистартырга', 34 | 'clip': 'кыскартырга', 35 | 'color': 'төс', 36 | 'cursor': 'курсор', 37 | 'display': 'чагылыш', 38 | 'filter': 'фильтр', 39 | 'float': 'калкавыч', 40 | 'font': 'минемшрифт', 41 | 'font-family': 'шрифтның-төре', 42 | 'font-size': 'шрифт-зурлыгы', 43 | 'font-style': 'шрифт-стиле', 44 | 'font-weight': 'шрифтның-калынлыгы', 45 | 'height': 'буй', 46 | 'left': 'сул', 47 | 'letter-spacing': 'xәрефләр-арасы', 48 | 'line-height': 'юлның-буе', 49 | 'margin': 'тышкыара', 50 | 'margin-bottom': 'аскы-тышкы-ара', 51 | 'margin-left': 'сул-тышкы-ара', 52 | 'margin-right': 'уң-тышкы-ара', 53 | 'margin-top': 'өске-тышкы-ара', 54 | 'overflow': 'кисергә', 55 | 'padding': 'эчкеара', 56 | 'padding-bottom': 'аскы-эчке-ара', 57 | 'padding-left': 'сул-эчке-ара', 58 | 'padding-right': 'уң-эчке-ара', 59 | 'padding-top': 'өске-эчке-ара', 60 | 'position': 'урыны', 61 | 'right': 'уң', 62 | 'text-align': 'текстны-тигезләү', 63 | 'text-decoration': 'текстны-бизәү', 64 | 'text-indent': 'кызыл-юл', 65 | 'text-shadow': 'текстның-шәүләсе', 66 | 'text-transform': 'текстны-үзгәртү', 67 | 'top': 'өс', 68 | 'visibility': 'күрү-мөмкинлеге', 69 | 'width': 'иң', 70 | 'word-spacing': 'интервал', 71 | 'z-index': 'блокның-дәрәҗәсе' 72 | }; 73 | 74 | var mapValues = { 75 | 'block': 'блок', 76 | 'bold': 'калын', 77 | 'bolder': 'бик-калын', 78 | 'both': 'икеседә', 79 | 'bottom': 'ас', 80 | 'center': 'урта', 81 | 'fixed': 'урында-калдыру', 82 | 'flex': 'флекс', 83 | 'inline': 'бер-юлда', 84 | 'italic': 'курсив', 85 | 'justify': 'иң-буенча', 86 | 'left': 'сул', 87 | 'lighter': 'юка', 88 | 'line-through': 'сызылган', 89 | 'list-item': 'исемлек-элементы', 90 | 'lowercase': 'юл-хәреф', 91 | 'middle': 'үзәктә', 92 | 'no-repeat': 'кабатламаска', 93 | 'none': 'юк', 94 | 'normal': 'стандарт', 95 | 'repeat': 'кабатлау', 96 | 'repeat-x': 'кабатлау-х', 97 | 'repeat-y': 'кабатлау-у', 98 | 'right': 'уң', 99 | 'solid': 'тоташ', 100 | 'top': 'өс', 101 | 'transparent': 'үтә-күренмә', 102 | 'underline': 'ассызыклау', 103 | 'uppercase': 'баш-хәреф', 104 | // Colors 105 | 'black': 'кара', 106 | 'blue': 'зәңгәр', 107 | 'brown': 'коңгырт', 108 | 'gold': 'алтын', 109 | 'gray': 'соры', 110 | 'green': 'яшел', 111 | 'orange': 'кызгылт-сары', 112 | 'pink': 'ал', 113 | 'red': 'кызыл', 114 | 'skyblue': 'күк-төсе', 115 | 'white': 'ак', 116 | 'yellow': 'сары' 117 | }; 118 | 119 | module.exports = postcss.plugin('postcss-tatar-stylesheets', function (opts) { 120 | opts = opts || {}; 121 | 122 | return function (css) { 123 | css.walkDecls(function transformDecl(decl) { 124 | // Properties 125 | _.forEach(mapProperties, function (value, key) { 126 | decl.prop = decl.prop.replace(value, key); 127 | }); 128 | // Values 129 | _.forEach(mapValues, function (value, key) { 130 | decl.value = decl.value.replace(value, key); 131 | }); 132 | // Important 133 | if (decl.value.indexOf('!мөһим') >= 0) { 134 | decl.value = decl.value.replace(/\s*!мөһим\s*/, ''); 135 | decl.important = true; 136 | } 137 | }); 138 | }; 139 | }); 140 | 141 | // Export Properties and Values for testing 142 | module.exports.mapProperties = mapProperties; 143 | module.exports.mapValues = mapValues; 144 | --------------------------------------------------------------------------------