Skip to content

Commit

Permalink
release: 2.0.0
Browse files Browse the repository at this point in the history
- camelcase of CSS properties
- remove bluebird as dependency
- add npmignore
- add editorconfig
- update README
  • Loading branch information
raphamorim committed Oct 22, 2017
1 parent 63336c2 commit 96da6ec
Show file tree
Hide file tree
Showing 19 changed files with 547 additions and 404 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.12.18
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "0.10"
- "0.12.18"
- "8.7.0"
script:
- "npm test"
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2017-present, Raphael Amorim

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> Convert pure CSS to javascript literal objects or React Style.
[![NPM Version](https://img.shields.io/npm/v/express.svg?style=flat)](https://www.npmjs.org/package/native-css)
[![Build Status](https://travis-ci.org/raphamorim/native-css.svg)](https://travis-ci.org/raphamorim/native-css)
[![Build Status](https://travis-ci.org/raphamorim/native-css.svg?branch=master)](https://travis-ci.org/raphamorim/native-css)

## Before Anything!

Expand Down Expand Up @@ -141,24 +141,26 @@ Input File (style.css):

@media (min-width: 768px){
body .container {
width: 748px !important
width: 748px !important;
box-sizing: 'all'
}
}
```

Output File (style.js):

```javascript
'@media screen and (min-width: 1020px)': {
__expression__: 'screen and (min-width: 1020px)',
'@media screen and (min-width:1020px)': {
__expression__: 'screen and (min-width:1020px)',
body__container: {
width: '1020px !important'
}
},
'@media (min-width: 768px)': {
__expression__: '(min-width: 768px)',
'@media (min-width:768px)': {
__expression__: '(min-width:768px)',
body__container: {
width: '748px !important'
width: '748px !important',
boxSizing: 'all'
}
}
```
Expand All @@ -181,7 +183,7 @@ var nativeCSS = require('native-css'),
URL = 'http://raw.githubusercontent.com/raphamorim/native-css/master/test/fixtures/sample.css';

// Generate JavaScript Object
nativeCSS.convertAsync(URL || Path) // returns bluebird Promise
nativeCSS.convertAsync(URL || Path) // returns Promise
.then(function(result) {
// convert/validate data
// return or throw
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./src/native-css.js');
module.exports = require('./src/native-css.js');
38 changes: 22 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
var fs = require('fs'),
input = process.argv[2];
input = process.argv[2];

exports.readFile = function(path) {
return fs.readFileSync(path, 'utf8');
}
return fs.readFileSync(path, 'utf8');
};

exports.writeFile = function(path, body) {
return fs.writeFileSync(path, body);
}
return fs.writeFileSync(path, body);
};

exports.appendFile = function(path, body) {
return fs.appendFileSync(path, body);
}
return fs.appendFileSync(path, body);
};

exports.verify = function(args) {
if (typeof args === 'object') {
if (args.indexOf(input) == -1)
return false;
if (typeof args === 'object') {
if (args.indexOf(input) == -1)
return false;

return true;
} else {
if (args != input)
return false;
return true;
} else {
if (args != input)
return false;

return true;
}
};

return true;
}
exports.camelize = function(str) {
return str.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
};
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "native-css",
"version": "1.2.5",
"version": "2.0.0",
"description": "Convert pure CSS to javascript literal objects or React Style",
"main": "index.js",
"bin": "./bin/native-css.js",
Expand All @@ -22,18 +22,20 @@
"convert"
],
"author": "Raphael Amorim",
"license": "ISC",
"license": "MIT",
"preferGlobal": "true",
"bugs": {
"url": "https://github.com/raphamorim/native-css/issues"
},
"engines": {
"node": ">=0.12.18"
},
"homepage": "https://github.com/raphamorim/native-css",
"devDependencies": {
"mocha": "^2.2.1"
},
"dependencies": {
"bluebird": "^3.3.1",
"css": "^2.2.0",
"css": "2.2.1",
"fetch": "^1.0.1"
}
}
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';

var nativeCSS = require('./native-css'),
verify = require('../lib').verify,
commands = process.argv;
verify = require('../lib').verify,
commands = process.argv;

if (verify(['-v', '--version']))
console.log(nativeCSS.version());
console.log(nativeCSS.version());

else if (verify(['-h', '--help']))
console.log(nativeCSS.help());
console.log(nativeCSS.help());

else {
var react = (commands.indexOf('--react') > -1),
outputPath = commands[3] || false;
var react = (commands.indexOf('--react') > -1),
outputPath = commands[3] || false;

var css = nativeCSS.convert(commands[2]);
var css = nativeCSS.convert(commands[2]);

nativeCSS.generateFile(css, outputPath, react);
nativeCSS.generateFile(css, outputPath, react);
}
Loading

0 comments on commit 96da6ec

Please sign in to comment.