Skip to content

Commit a62697e

Browse files
edit Readme.md
1 parent a3e692d commit a62697e

File tree

6 files changed

+94
-51
lines changed

6 files changed

+94
-51
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# react-native-css-parse
22
> 将普通的 css 文件编译为 react-native 的stylesheet
33
4-
# 有待改进
4+
# 安装
55

6-
[] 具备输入匹配功能,自动识别路径下的 .css 文件,并编译为相应的 .js 文件;
6+
* As Node Module
7+
```
8+
npm install react-native-css-parse
9+
```
10+
* As CLI
11+
12+
```
13+
npm install react-native-css-parse -g
14+
```
15+
16+
# 使用
17+
18+
```
19+
react-native-css-parse -i <input>
20+
```
21+
22+
### 有待改进
23+
24+
1. 输入功能,自动识别路径下的 .css 文件;
25+
2. 输出功能,自动编译为 .js 文件;

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _ = require('./utils'),
1+
var _ = require('./utils.js'),
22
_cssParse = require('css-parse'),
33
// 不支持属性的正则
44
_unsupportedRegExp = new RegExp('^(display)|(transtion)|(background-[^c])|(box-sizing)', 'g'),

lib/utils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var fs = require('fs');
22

33
const color = ['red', 'green', 'blue', 'pink'];
44

5-
module.exports = {
5+
const _ = {
66

77
/**
88
* 读取 css 文件
@@ -108,4 +108,6 @@ module.exports = {
108108
num.indexOf('%') !== -1;
109109
},
110110

111-
};
111+
};
112+
113+
module.exports = _;

npm-debug.log

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,34 @@
1212
7 silly cache add rawSpec: '.',
1313
7 silly cache add spec: '/Users/wangsiyuan/Works/css-parse',
1414
7 silly cache add type: 'directory' }
15-
8 verbose addLocalDirectory /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package.tgz not in flight; packing
15+
8 verbose addLocalDirectory /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package.tgz not in flight; packing
1616
9 verbose correctMkdir /Users/wangsiyuan/.npm correctMkdir not in flight; initializing
17-
10 verbose tar pack [ '/Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package.tgz',
17+
10 verbose tar pack [ '/Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package.tgz',
1818
10 verbose tar pack '/Users/wangsiyuan/Works/css-parse' ]
19-
11 verbose tarball /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package.tgz
19+
11 verbose tarball /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package.tgz
2020
12 verbose folder /Users/wangsiyuan/Works/css-parse
21-
13 info prepublish react-native-css-parse@0.1.0
22-
14 verbose addLocalTarball adding from inside cache /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package.tgz
21+
13 info prepublish react-native-css-parse@0.1.6
22+
14 verbose addLocalTarball adding from inside cache /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package.tgz
2323
15 verbose correctMkdir /Users/wangsiyuan/.npm correctMkdir not in flight; initializing
24-
16 silly cache afterAdd react-native-css-parse@0.1.0
25-
17 verbose afterAdd /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package/package.json not in flight; writing
24+
16 silly cache afterAdd react-native-css-parse@0.1.6
25+
17 verbose afterAdd /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package/package.json not in flight; writing
2626
18 verbose correctMkdir /Users/wangsiyuan/.npm correctMkdir not in flight; initializing
27-
19 verbose afterAdd /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package/package.json written
27+
19 verbose afterAdd /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package/package.json written
2828
20 silly publish { name: 'react-native-css-parse',
29-
20 silly publish version: '0.1.0',
29+
20 silly publish version: '0.1.6',
3030
20 silly publish description: 'css parser for react-native',
31-
20 silly publish main: 'index.js',
31+
20 silly publish main: '/bin/index.js',
3232
20 silly publish scripts: { test: 'mocha' },
3333
20 silly publish keywords: [ 'css', 'parse', 'sass', 'react-native' ],
3434
20 silly publish author: { name: 'wangsiyuan' },
3535
20 silly publish license: 'MIT',
36-
20 silly publish dependencies: { 'css-parse': '^2.0.0', mocha: '^3.2.0' },
37-
20 silly publish devDependencies: { chai: '^3.5.0' },
38-
20 silly publish readme: '# react-native-css-parse',
36+
20 silly publish dependencies: { 'css-parse': '^2.0.0' },
37+
20 silly publish devDependencies: { chai: '^3.5.0', mocha: '^3.2.0' },
38+
20 silly publish readme: '# react-native-css-parse\n> 将普通的 css 文件编译为 react-native 的stylesheet\n\n# 有待改进\n\n[] 具备输入匹配功能,自动识别路径下的 .css 文件,并编译为相应的 .js 文件;\n',
3939
20 silly publish readmeFilename: 'README.md',
40-
20 silly publish gitHead: 'a0ddcf9e91fee754cbe4ea34c04deb035d185737',
41-
20 silly publish _id: 'react-native-css-parse@0.1.0',
42-
20 silly publish _shasum: 'c852ca21693aad20150f56b831dace0288a14517',
40+
20 silly publish gitHead: 'a3e692d1d9cd0e89758fc8eef9f8b31d61d7b229',
41+
20 silly publish _id: 'react-native-css-parse@0.1.6',
42+
20 silly publish _shasum: 'bdcb2f86bed91bbde604c6a38301fa3af1ca8ee2',
4343
20 silly publish _from: '.' }
4444
21 verbose getPublishConfig undefined
4545
22 silly mapToRegistry name react-native-css-parse
@@ -54,29 +54,29 @@
5454
25 silly mapToRegistry type: 'tag' }
5555
26 silly mapToRegistry uri https://registry.npmjs.org/react-native-css-parse
5656
27 verbose publish registryBase https://registry.npmjs.org/
57-
28 silly publish uploading /Users/wangsiyuan/.npm/react-native-css-parse/0.1.0/package.tgz
57+
28 silly publish uploading /Users/wangsiyuan/.npm/react-native-css-parse/0.1.6/package.tgz
5858
29 verbose request uri https://registry.npmjs.org/react-native-css-parse
5959
30 verbose request sending authorization for write operation
60-
31 info attempt registry request try #1 at 2:47:42 PM
60+
31 info attempt registry request try #1 at 3:57:56 PM
6161
32 verbose request using bearer token for auth
62-
33 verbose request id f3e0d22ff9078cf8
62+
33 verbose request id 8fe620d2c2a06c76
6363
34 http request PUT https://registry.npmjs.org/react-native-css-parse
6464
35 http 403 https://registry.npmjs.org/react-native-css-parse
6565
36 verbose headers { 'content-type': 'application/json',
6666
36 verbose headers 'cache-control': 'max-age=300',
6767
36 verbose headers 'content-length': '95',
6868
36 verbose headers 'accept-ranges': 'bytes',
69-
36 verbose headers date: 'Tue, 28 Feb 2017 06:47:44 GMT',
69+
36 verbose headers date: 'Tue, 28 Feb 2017 07:57:57 GMT',
7070
36 verbose headers via: '1.1 varnish',
7171
36 verbose headers connection: 'keep-alive',
72-
36 verbose headers 'x-served-by': 'cache-itm7425-ITM',
72+
36 verbose headers 'x-served-by': 'cache-nrt6125-NRT',
7373
36 verbose headers 'x-cache': 'MISS',
7474
36 verbose headers 'x-cache-hits': '0',
75-
36 verbose headers 'x-timer': 'S1488264463.439385,VS0,VE628',
75+
36 verbose headers 'x-timer': 'S1488268676.976521,VS0,VE565',
7676
36 verbose headers vary: 'Accept-Encoding' }
7777
37 verbose request invalidating /Users/wangsiyuan/.npm/registry.npmjs.org/react-native-css-parse on PUT
7878
38 error publish Failed PUT 403
79-
39 verbose stack Error: "You cannot publish over the previously published version 0.1.0." : react-native-css-parse
79+
39 verbose stack Error: "You cannot publish over the previously published version 0.1.6." : react-native-css-parse
8080
39 verbose stack at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:264:12)
8181
39 verbose stack at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:252:14)
8282
39 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
@@ -95,7 +95,7 @@
9595
45 error node v6.4.0
9696
46 error npm v2.15.5
9797
47 error code E403
98-
48 error "You cannot publish over the previously published version 0.1.0." : react-native-css-parse
98+
48 error "You cannot publish over the previously published version 0.1.6." : react-native-css-parse
9999
49 error If you need help, you may report this error at:
100100
49 error <https://github.com/npm/npm/issues>
101101
50 verbose exit [ 1, true ]

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
2-
"name": "react-native-css-parse",
3-
"version": "0.1.1",
4-
"description": "css parser for react-native",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "mocha"
8-
},
9-
"keywords": [
10-
"css",
11-
"parse",
12-
"sass",
13-
"react-native"
14-
],
15-
"author": "wangsiyuan",
16-
"license": "MIT",
17-
"dependencies": {
18-
"css-parse": "^2.0.0",
19-
"mocha": "^3.2.0"
20-
},
21-
"devDependencies": {
22-
"chai": "^3.5.0"
23-
}
2+
"name": "react-native-css-parse",
3+
"version": "0.1.7",
4+
"description": "css parser for react-native",
5+
"main": "/bin/index.js",
6+
"scripts": {
7+
"test": "mocha"
8+
},
9+
"keywords": [
10+
"css",
11+
"parse",
12+
"sass",
13+
"react-native"
14+
],
15+
"author": "wangsiyuan",
16+
"license": "MIT",
17+
"dependencies": {
18+
"css-parse": "^2.0.0"
19+
},
20+
"devDependencies": {
21+
"chai": "^3.5.0",
22+
"mocha": "^3.2.0"
23+
}
2424
}

shim.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
if (typeof __dirname === 'undefined') global.__dirname = '/'
2+
if (typeof __filename === 'undefined') global.__filename = ''
3+
if (typeof process === 'undefined') {
4+
global.process = require('process')
5+
} else {
6+
var bProcess = require('process')
7+
for (var p in bProcess) {
8+
if (!(p in process)) {
9+
process[p] = bProcess[p]
10+
}
11+
}
12+
}
13+
14+
process.browser = false
15+
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer
16+
17+
// global.location = global.location || { port: 80 }
18+
var isDev = typeof __DEV__ === 'boolean' && __DEV__
19+
process.env['NODE_ENV'] = isDev ? 'development' : 'production'
20+
if (typeof localStorage !== 'undefined') {
21+
localStorage.debug = isDev ? '*' : ''
22+
}

0 commit comments

Comments
 (0)