Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Commit aa07ca7

Browse files
author
deepsweet
committed
🐣
0 parents  commit aa07ca7

File tree

11 files changed

+151
-0
lines changed

11 files changed

+151
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org/
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 4
11+
12+
[*.{json,yml}]
13+
indent_size = 2
14+
15+
[{.babelrc,.eslintrc}]
16+
indent_size = 2

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage/
2+
tmp/

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": [ "rebem/configs/common" ]
3+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
tmp/
3+
coverage/
4+
*.sublime-*
5+
*.log
6+
.DS_Store

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
3+
language: node_js
4+
5+
# cache:
6+
# directories:
7+
# - node_modules
8+
9+
node_js:
10+
- "5"
11+
12+
branches:
13+
only:
14+
- master
15+
16+
script: npm run travis

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015–2016 Kir Belevich
4+
Copyright (c) 2015–2016 Denis Koltsov
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[![npm](https://img.shields.io/npm/v/rebem-css.svg?style=flat-square)](https://www.npmjs.com/package/rebem-css)
2+
[![travis](http://img.shields.io/travis/rebem/css.svg?style=flat-square)](https://travis-ci.org/rebem/css)
3+
[![coverage](https://img.shields.io/codecov/c/github/rebem/css.svg?style=flat-square)](https://codecov.io/github/rebem/css)
4+
[![deps](https://img.shields.io/gemnasium/rebem/css.svg?style=flat-square)](https://gemnasium.com/rebem/css)
5+
6+
WIP

lib/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var postcss = require('postcss');
2+
3+
var modDelim = '_';
4+
var elemDelim = '__';
5+
6+
module.exports = postcss.plugin('bemcss', function() {
7+
return function(css) {
8+
css.walkRules(function(rule) {
9+
rule.selector = rule.selector
10+
.replace(/:block\(([\w-]+)\)/g, '.$1')
11+
.replace(/:elem\(([\w-]+)\)/g, elemDelim + '$1')
12+
.replace(/:mod\(([\w-]+)\s?([\w-]+)?\)/g, function(match, mod, val) {
13+
if (val) {
14+
return modDelim + mod + modDelim + val;
15+
}
16+
17+
return modDelim + mod;
18+
});
19+
});
20+
};
21+
});

package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "rebem-css",
3+
"version": "0.1.0",
4+
"description": "",
5+
"keywords": [ "rebem", "bem", "css" ],
6+
"homepage": "https://github.com/rebem/css",
7+
"repository": "rebem/css",
8+
"contributors": [
9+
"Kir Belevich <kir@soulshine.in> (https://github.com/deepsweet)",
10+
"Denis Koltsov <iam@mistadikay.com> (https://github.com/mistadikay)"
11+
],
12+
"main": "lib/index.js",
13+
"files": [ "index.js" ],
14+
"dependencies": {
15+
"postcss": "5.0.x"
16+
},
17+
"devDependencies": {
18+
"husky": "0.10.x",
19+
"rimraf": "2.5.x",
20+
"eslint": "1.10.x",
21+
"eslint-config-rebem": "0.1.x",
22+
"mocha": "2.3.x",
23+
"istanbul": "0.4.x",
24+
"codecov": "1.0.x"
25+
},
26+
"scripts": {
27+
"lint": "eslint .",
28+
"pretest": "npm run lint",
29+
"test": "mocha --recursive",
30+
"precoverage": "rimraf coverage/",
31+
"coverage": "istanbul cover _mocha -- --recursive",
32+
33+
"precodecov": "npm run coverage",
34+
"codecov": "codecov --file=coverage/lcov.info --disable=search,gcov",
35+
"pretravis": "npm run lint",
36+
"travis": "npm run codecov",
37+
38+
"prepush": "npm test"
39+
},
40+
"engines": {
41+
"node": ">=0.12.0",
42+
"npm": ">=2.7.0"
43+
},
44+
"license": "MIT"
45+
}

test/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
}
5+
}

0 commit comments

Comments
 (0)