Skip to content

Commit 609c251

Browse files
committed
feat: initial commit
0 parents  commit 609c251

File tree

14 files changed

+311
-0
lines changed

14 files changed

+311
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
lib/
3+
examples/webpack/bundle
4+
npm-debug.log

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src/
2+
npm-debug.log
3+
.nyc_output/
4+
coverage/

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.DELETE_ON_ERROR:
2+
3+
BIN = ./node_modules/.bin
4+
TESTS = $(shell find src -path '*/__tests__/*-test.js')
5+
FIXTURES = $(shell find src -path '*/__tests__/*-fixture/*.js')
6+
SRC = $(filter-out $(TESTS) $(FIXTURES), $(shell find src -name '*.js'))
7+
LIB = $(SRC:src/%=lib/%)
8+
MOCHA_OPTS = -R dot --require babel-core/register
9+
10+
build::
11+
@$(MAKE) -j 8 $(LIB)
12+
13+
lint::
14+
@$(BIN)/eslint src
15+
16+
check::
17+
@$(BIN)/flow --show-all-errors src
18+
19+
test::
20+
@$(BIN)/mocha $(MOCHA_OPTS) $(TESTS)
21+
22+
ci::
23+
@$(BIN)/mocha $(MOCHA_OPTS) --watch --watch-extensions json,md $(TESTS)
24+
25+
version-major version-minor version-patch:: lint test
26+
@npm version $(@:version-%=%)
27+
28+
push::
29+
@git push --tags origin HEAD:master
30+
31+
clean::
32+
@rm -rf lib
33+
34+
lib/%.js: src/%.js
35+
@echo "Building $<"
36+
@mkdir -p $(@D)
37+
@$(BIN)/babel $(BABEL_OPTIONS) -o $@ $<

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# React CSS components
2+
3+
React CSS components is a CSS based module format to define styled React DOM
4+
components.
5+
6+
Example `styles.react.css`:
7+
8+
Label {
9+
color: red;
10+
}
11+
12+
Then:
13+
14+
import {Label} from './styles.react.css'
15+
16+
<Label /> // => <div className="<autogenerated classname>">...</div>

examples/webpack/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["prometheusresearch"]
3+
}

examples/webpack/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div id="main">
2+
<script src="bundle/bundle.js"></script>

examples/webpack/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import {Header, Content, Root} from './styles.react.css';
4+
5+
ReactDOM.render(
6+
<Root>
7+
<Header>Header</Header>
8+
<Content>Content</Content>
9+
</Root>,
10+
document.getElementById('main')
11+
);

examples/webpack/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "react-css-components-example-webpack",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"build": "webpack",
7+
"watch": "webpack -w"
8+
},
9+
"dependencies": {
10+
"babel-loader": "^6.2.4",
11+
"css-loader": "^0.23.1",
12+
"react": "^15.0.0",
13+
"react-css-components": "../../",
14+
"react-dom": "^15.0.0",
15+
"style-loader": "^0.13.1",
16+
"webpack": "^1.12.14"
17+
}
18+
}

examples/webpack/styles.react.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Root {
2+
padding: 10px;
3+
font-family: Menlo;
4+
}
5+
6+
Header {
7+
font-size: 200%;
8+
font-weight: bold;
9+
color: black;
10+
}
11+
12+
Content {
13+
color: #444;
14+
}

examples/webpack/webpack.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var path = require('path');
2+
3+
module.exports = {
4+
entry: './index.js',
5+
output: {
6+
path: 'bundle',
7+
filename: 'bundle.js',
8+
},
9+
devtool: 'cheap-eval-source-map',
10+
resolve: {
11+
fallback: path.join(__dirname, 'node_modules'),
12+
},
13+
resolveLoader: {
14+
fallback: path.join(__dirname, 'node_modules'),
15+
},
16+
module: {
17+
loaders: [
18+
{
19+
test: /\.react.css$/,
20+
loader: 'babel-loader!react-css-components/webpack',
21+
},
22+
{
23+
test: /\.js$/,
24+
exclude: /node_modules/,
25+
loader: 'babel-loader',
26+
}
27+
]
28+
}
29+
};

0 commit comments

Comments
 (0)