Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rtlcss

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtlcss - npm Package Compare versions

Comparing version 1.6.2 to 1.6.3

12

bin/rtlcss.js

@@ -153,3 +153,7 @@ #!/usr/bin/env node

}
var result, opt = { map: undefined, from:undefined, to:undefined};
var result, opt = { map: false };
if(input !== '-'){
opt.from = input;
opt.to = output;
}
if(!config){

@@ -159,6 +163,4 @@ printWarning('rtlcss: Warning! No config present, using defaults.');

}else{
if(config.map === true && input !== '-'){
if('map' in config === true && input !== '-'){
opt.map = config.map;
opt.from = input;
opt.to = output;
}

@@ -178,3 +180,3 @@ result = rtlcss(config.options,

fs.writeFile(savePath, result.css, 'utf8', function(err){ err && printError(err); });
if(opt.map == true){
if(result.map){
fs.writeFile(savePath + '.map', result.map, 'utf8', function(err){ err && printError(err); } );

@@ -181,0 +183,0 @@ }

@@ -75,2 +75,4 @@ RTLCSS CLI

Source Map generation is disabled by default, you can enable it by setting `map` config to `true`. If you want more control over source map generation, visit [postcss](https://github.com/postcss/postcss/blob/4.1.16/README.md#source-map) for more details on the available options.
### STDIN

@@ -77,0 +79,0 @@ Read input from `stdin`

@@ -10,3 +10,3 @@ function main(configuration) {

if (!config.preserveDirectives)
decl._value.raw = decl._value.raw.replace(/\/\*(?:!)?rtl:[^]*?\*\//img, "");
decl.raws.value.raw = decl.raws.value.raw.replace(/\/\*(?:!)?rtl:[^]*?\*\//img, "");
return true;

@@ -21,5 +21,5 @@ }

this.expr.lastIndex = 0;
var newValue = this.expr.exec(decl._value.raw)[1];
var newValue = this.expr.exec(decl.raws.value.raw)[1];
if (config.preserveComments)
decl._value.raw = newValue + (config.preserveDirectives ? decl._value.raw : decl._value.raw.replace(this.replace, ""));
decl.raws.value.raw = newValue + (config.preserveDirectives ? decl.raws.value.raw : decl.raws.value.raw.replace(this.replace, ""));
else

@@ -36,5 +36,5 @@ decl.value = newValue + decl.value;

this.expr.lastIndex = 0;
var newValue = this.expr.exec(decl._value.raw)[1];
var newValue = this.expr.exec(decl.raws.value.raw)[1];
if (config.preserveComments)
decl._value.raw = (config.preserveDirectives ? decl._value.raw : decl._value.raw.replace(this.replace, "")) + newValue;
decl.raws.value.raw = (config.preserveDirectives ? decl.raws.value.raw : decl.raws.value.raw.replace(this.replace, "")) + newValue;
else

@@ -51,9 +51,9 @@ decl.value += newValue;

this.expr.lastIndex = 0;
var result = this.expr.exec(decl._value.raw);
var result = this.expr.exec(decl.raws.value.raw);
var directive = result[0];
var newValue = result[1];
if (config.preserveComments)
decl._value.raw = decl._value.raw.replace(this.replace, newValue + (config.preserveDirectives ? directive : ""));
decl.raws.value.raw = decl.raws.value.raw.replace(this.replace, newValue + (config.preserveDirectives ? directive : ""));
else
decl.value = decl._value.raw.replace(this.replace, newValue);
decl.value = decl.raws.value.raw.replace(this.replace, newValue);
return true;

@@ -67,3 +67,3 @@ }

this.expr.lastIndex = 0;
var result = this.expr.exec(decl._value.raw);
var result = this.expr.exec(decl.raws.value.raw);
var directive = result[0];

@@ -70,0 +70,0 @@ var newValue = result[1];

@@ -15,3 +15,3 @@ (function () {

RTLCSS.prototype.postcss = function (css) {
css.eachRule(function (rule, idx) {
css.walkRules(function (rule, idx) {
var previousComment = { 'text': '', removeSelf: function () { } };

@@ -27,3 +27,3 @@ if (idx > 0 && rule.parent.nodes[idx - 1].type == 'comment')

if (!config.preserveDirectives)
previousComment.removeSelf();
previousComment.remove();
return;

@@ -34,3 +34,3 @@ }

var flipped = 0;
rule.eachDecl(function (decl, index) {
rule.walkDecls(function (decl, index) {
if (decl.type == "comment")

@@ -42,3 +42,4 @@ return;

var pi = config.instructions.declarations[x];
if (decl._value && decl._value.raw && decl._value.raw.match(pi.expr) && pi.action(decl)) {
//console.log('raws', decl.raws, '_value', decl._value);
if (decl.raws.value && decl.raws.value.raw && decl.raws.value.raw.match(pi.expr) && pi.action(decl)) {
util.logDeclAction(decl, pi);

@@ -53,3 +54,3 @@ return;

if (decl.prop.match(pi.expr)) {
var rawValue = config.preserveComments && decl._value && decl._value.raw ? decl._value.raw : decl.value;
var rawValue = config.preserveComments && decl.raws.value && decl.raws.value.raw ? decl.raws.value.raw : decl.value;
var result;

@@ -81,3 +82,3 @@ if (config.preserveComments) {

//loop @ rules
css.eachAtRule(function (atRule) {
css.walkAtRules(function (atRule) {
atRule.params = util.applyStringMap(atRule.params, false, true);

@@ -88,3 +89,2 @@ if (config.minify) {

atRule.after = '';
delete atRule._params;
}

@@ -94,15 +94,13 @@ });

if (config.minify) {
css.eachDecl(function (decl) {
decl.before = '';
decl.between = ':';
delete decl._value;
css.walkDecls(function (decl) {
decl.raws.before = '';
decl.raws.between = ':';
});
css.eachRule(function (rule) {
rule.before = '';
rule.between = '';
rule.after = '';
delete rule._selector;
css.walkRules(function (rule) {
rule.raws.before = '';
rule.raws.between = '';
rule.raws.after = '';
});
css.eachComment(function (comment) {
comment.removeSelf();
css.walkComments(function (comment) {
comment.remove();
});

@@ -109,0 +107,0 @@ }

{
"author": "Mohammad Younes",
"name": "rtlcss",
"version": "1.6.2",
"version": "1.6.3",
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)",

@@ -17,3 +17,3 @@ "bugs": "https://github.com/MohammadYounes/rtlcss/issues?state=open",

"dependencies": {
"postcss": "^4.0.0",
"postcss": "^5.0.0",
"chalk": "^1.0.0",

@@ -20,0 +20,0 @@ "findup": "0.1.5",

@@ -1,2 +0,2 @@

# RTLCSS [![GitHub version](https://badge.fury.io/gh/MohammadYounes%2Frtlcss.svg)](http://badge.fury.io/gh/MohammadYounes%2Frtlcss) [![NPM version](https://badge.fury.io/js/rtlcss.svg)](http://badge.fury.io/js/rtlcss) [![Build Status](https://travis-ci.org/MohammadYounes/rtlcss.svg?branch=master)](https://travis-ci.org/MohammadYounes/rtlcss) [![DEPENDENCIES](https://david-dm.org/MohammadYounes/rtlcss.svg)](https://david-dm.org/MohammadYounes/rtlcss)
# RTLCSS [![GitHub version](https://badge.fury.io/gh/MohammadYounes%2Frtlcss.svg)](http://badge.fury.io/gh/MohammadYounes%2Frtlcss) [![NPM version](https://badge.fury.io/js/rtlcss.svg)](http://badge.fury.io/js/rtlcss) [![Build Status](https://travis-ci.org/MohammadYounes/rtlcss.svg?branch=master)](https://travis-ci.org/MohammadYounes/rtlcss) [![DEPENDENCIES](https://david-dm.org/MohammadYounes/rtlcss.svg)](https://david-dm.org/MohammadYounes/rtlcss) [![Twitter](https://img.shields.io/badge/follow-%40rtlcss-blue.svg)](https://twitter.com/rtlcss)

@@ -58,3 +58,3 @@ <img style="margin:15px" title="RTL CSS" src="https://cloud.githubusercontent.com/assets/4712046/5889219/190f366a-a425-11e4-8ef5-8b5f60a9e903.png" align="right"/>

##Who's using RTLCSS
## Who's using RTLCSS

@@ -135,3 +135,3 @@ * [AlertifyJS] a javascript framework for developing pretty browser dialogs and notifications.

When RTLing a CSS document, there are cases where it's impossible to know if the property value should be mirrored or not! If the rule selector need to be changed! Or a none directional property have to be updated. In such cases, RTLCSS provides processing directives in the form of CSS comments, both standard ```/*rtl:...*/``` and special/important ```/*!rtl:...*/``` notations are supported.
When RTLing a CSS document, there are cases where it's impossible to know whether to mirror a property value, whether to change a rule selector, or whether to update a non-directional property. In such cases, RTLCSS provides processing directives in the form of CSS comments. Both standard ```/*rtl:...*/``` and special/important ```/*!rtl:...*/``` notations are supported.

@@ -256,3 +256,3 @@ Two sets of processing directives are available, on Rule and Declaration level.

String map is a collection of map objects, each defines mapping between directional strings, it is used in selectors renaming and URL updates. The following is the default string map:
String map is a collection of map objects, where each defines a mapping between directional strings. It is used in renaming selectors and URL updates. The following is the default string map:
```javascript

@@ -415,2 +415,6 @@ [

## Release Notes
* **v1.6.3** [28 Aug. 2015]
* CLI: fix source map option (issue #40).
* Upgrade to [POSTCSS] v5.0.x
* **v1.6.2** [21 Jul. 2015]

@@ -417,0 +421,0 @@ * CLI: fix loading custom configuration file manually via the --config flag. **Thanks @KeyKaKiTO**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc