Comparing version 0.1.3 to 0.2.0
@@ -24,2 +24,3 @@ function main(options, rules, declarations, properties) { | ||
addKey('minify', false); | ||
addKey('postcssOptions', {}); | ||
@@ -50,3 +51,3 @@ if (config.minify) | ||
if (instructions != null && instructions.length) | ||
if (properties != null && properties.length) | ||
for (var x = 0; x < properties.length; x++) { | ||
@@ -53,0 +54,0 @@ var prop = properties[x]; |
@@ -182,3 +182,3 @@ function main(configuration) { | ||
item = util.swapLeftRight(item); | ||
if (item.match(/deg/i)) | ||
if (item.match(/deg|g?rad|turn/i)) | ||
item = util.negate(item); | ||
@@ -185,0 +185,0 @@ } |
@@ -0,10 +1,15 @@ | ||
(function() { | ||
"use strict"; | ||
var config,util,postcss; | ||
function rtlcss(css, options, rules, declarations, properties) { | ||
var postcss = require('postcss'); | ||
var config = require('./config.js').configure(options, rules, declarations, properties); | ||
var util = require('./util.js').configure(config); | ||
var processor = postcss(function (css) { | ||
var RTLCSS = (function() { | ||
function RTLCSS(options, rules, declarations, properties) { | ||
postcss = require('postcss'); | ||
config = require('./config.js').configure(options, rules, declarations, properties); | ||
util = require('./util.js').configure(config); | ||
} | ||
RTLCSS.prototype.process = function(css) { | ||
return postcss(this.postcss).process(css,config.postcssOptions).css; | ||
}; | ||
RTLCSS.prototype.postcss = function (css) { | ||
css.eachRule(function (rule, idx) { | ||
@@ -96,6 +101,16 @@ var previousComment = { 'text': '', removeSelf: function () { } }; | ||
} | ||
}); | ||
}; | ||
return RTLCSS; | ||
})(); | ||
return processor.process(css).css; | ||
var rtlcss = function(options, rules, declarations, properties) { | ||
return new RTLCSS(options, rules, declarations, properties); | ||
}; | ||
rtlcss.process = function(css, options, rules, declarations, properties){ | ||
return new RTLCSS(options, rules, declarations, properties).process(css); | ||
} | ||
module.exports.process = rtlcss; | ||
module.exports = rtlcss; | ||
}).call(this); |
{ | ||
"author": "Mohammad Younes", | ||
"name": "rtlcss", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -67,6 +67,6 @@ RTLCSS | ||
| `/*rtl:ignore*/` | Ignores processing of this declaration. | ||
| `/*rtl:{value}*/` | Replaces the declaration property value with `{value}`. | ||
| `/*rtl:append:{value}*/` | Appends `{value}` to the end of the declaration property value. | ||
| `/*rtl:prepend:{value}*/` | Prepends `{value}` to the begining of the declaration property value. | ||
| `/*rtl:insert:{value}*/` | Inserts `{value}` to where the directive is located inside the declaration property value. | ||
| `/*rtl:{value}*/` | Replaces the declaration value with `{value}`. | ||
| `/*rtl:append:{value}*/` | Appends `{value}` to the end of the declaration value. | ||
| `/*rtl:prepend:{value}*/` | Prepends `{value}` to the begining of the declaration value. | ||
| `/*rtl:insert:{value}*/` | Inserts `{value}` to where the directive is located inside the declaration value. | ||
@@ -94,4 +94,12 @@ **Example** | ||
``` | ||
> Built on top of [PostCSS](https://github.com/ai/postcss), an awesome framework, providing you with the power of manipulating CSS via a JS API. | ||
> Built on top of [PostCSS], an awesome framework, providing you with the power of manipulating CSS via a JS API. | ||
> It can be combined with other processors, such as autoprefixer: | ||
```javascript | ||
var processed = postcss() | ||
.use(rtlcss(/* options , rules, declarations, properties*/).postcss) | ||
.use(autoprefixer().postcss) | ||
.process(css); | ||
``` | ||
### options (object) | ||
@@ -111,2 +119,3 @@ | ||
|**`minify`** | `false` | Minifies output CSS, when set to `true` both `preserveDirectives` and `preserveComments` will be set to `false` . | ||
|**`postcssOptions`** | `{}` | POSTCSS options object. | ||
@@ -123,3 +132,3 @@ ### rules (array) | ||
> Visit [PostCSS](https://github.com/ai/postcss) to find out more about [`rule`](https://github.com/ai/postcss#rule-node) node. | ||
> Visit [PostCSS] to find out more about [`rule`](https://github.com/ai/postcss#rule-node) node. | ||
@@ -149,3 +158,3 @@ ##### **Example** | ||
> Visit [PostCSS](https://github.com/ai/postcss) to find out more about [`decl`](https://github.com/ai/postcss#declaration-node) node. | ||
> Visit [PostCSS] to find out more about [`decl`](https://github.com/ai/postcss#declaration-node) node. | ||
@@ -202,2 +211,10 @@ ##### **Example** | ||
* **v0.2.0** [20 Mar. 2014] | ||
* Support combining with other processors. | ||
* Support rad, grad & turn angle units when flipping linear-gradient | ||
* Fix typo in config.js | ||
* **v0.1.3** [7 Mar. 2014] | ||
* Fix missing include in rules.js | ||
* **v0.1.2** [5 Mar. 2014] | ||
@@ -210,1 +227,2 @@ * New option: minify output CSS. | ||
[PostCSS]: https://github.com/ai/postcss |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32820
601
221