How to use the rtlcss.process function in rtlcss

To help you get started, we’ve selected a few rtlcss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / newspack-theme / scripts / compile-scss.js View on Github external
.then( result => {
							// save the file
							saveFile( outFile, result.css );
							// save the RTL version file
							if ( withRTL ) {
								saveFile( outFile.replace( '.css', '-rtl.css' ), rtlcss.process( result.css ) );
							}

							resolve( outFile );
						} );
				}
github romainberger / webpack-rtl-plugin / src / index.js View on Github external
chunk.files.forEach(asset => {
          const match = this.options.test ? new RegExp(this.options.test).test(asset) : true

          if (path.extname(asset) !== '.css') {
            return
          }

          const baseSource = compilation.assets[asset].source()
          let filename
          let rtlSource

          if (match) {
            rtlSource = rtlcss.process(baseSource, this.options.options, this.options.plugins)

            if (this.options.filename instanceof Array && this.options.filename.length === 2) {
              filename = asset.replace(this.options.filename[0], this.options.filename[1])
            }
            else if (this.options.filename) {
              filename = this.options.filename

              if (/\[contenthash]/.test(this.options.filename)) {
                const hash = createHash('md5').update(rtlSource).digest('hex').substr(0, 10)
                filename = filename.replace('[contenthash]', hash)
              }
              if (/\[id]/.test(this.options.filename)) {
                filename = filename.replace('[id]', chunk.id)
              }
              if (/\[name]/.test(this.options.filename)) {
                filename = filename.replace('[name]', chunk.name)
github vkalinichev / postcss-rtl / src / decls.js View on Github external
const rtlifyDecl = (decl, keyframes) => {
  let {prop, value} = decl;

  if (decl.prop.match(/animation/)) {
    value = getProcessedKeyframeValue(decl, keyframes, 'rtl');
  } else {
    const rtlResult = rtlcss.process(decl, null, null);

    if (rtlResult === decl.toString()) {
      return null;
    }

    [, prop, value] = rtlResult.match(/([^:]*):\s*(.*)/) || [];

    value = value.replace(/\s*!important/, '');
  }
  return {prop, value};
};
github vkalinichev / postcss-rtl / src / rules.js View on Github external
const rtlifyRule = (rule) => {
  const rtlResult = rtlcss.process(rule, null, null);

  return (rtlResult !== rule.toString()) ? rtlResult : false;
};
github Automattic / delphin / server / index.js View on Github external
const addCss = styles => (
		css.push( isRtl ? rtlcss.process( styles._getCss() ) : styles._getCss() )
	);
github linkedin / postcss-lang-optimizer / lib / langOptimizer.js View on Github external
}

    if (options.includeBaseFile || typeof options.includeBaseFile === "undefined") {
      if (langResult) {
        langCSS = result.css + "\n" + langResult + "\n";
      } else {
        langCSS = result.css;
      }
    } else if (langResult) {
      langCSS = langResult + "\n";
    }

    if (options.rtlLangs && options.rtlLangs.indexOf(lang) >= 0) {
      addOutputFile(
        rtlcss.process(langCSS, options.rtlOptions),
        langFilename
      );
    } else {
      addOutputFile(langCSS, langFilename);
    }
  });
};
github OraOpenSource / apex-nitro / lib / rtlcss.js View on Github external
return through.obj(function (file, enc, cb) {
        if (file.isNull()) {
            return cb(null, file);
        }

        if (file.isStream()) {
            return cb(new gutil.PluginError('apex-frontend-boost-rtlcss', 'Streaming not supported'));
        }

        if (file.extname == '.map') {
            return cb(null, file);
        }

        file.contents = new Buffer(rtlcss.process(file.contents.toString()));
        this.push(file);
        cb();
    });
};
github Foundry376 / Mailspring / app / src / less-compile-cache.ts View on Github external
this.cache.parseLess = (filePath, contents) => {
        const { imports, css } = original.call(this.cache, filePath, contents);
        return { imports, css: rtlcss.process(css) };
      };
    }
github LeadcoinNetwork / Web-App-Project / frontend / webpack.rtl.duplicate.js View on Github external
module.exports.default = function(str) {
  str = ".ldc-ltr {" + str + "} .ldc-rtl {" + rtlcss.process(str) + "}"
  return str
}
github Foundry376 / Mailspring / app / src / less-compile-cache.es6 View on Github external
this.cache.parseLess = (filePath, contents) => {
        const { imports, css } = original.call(this.cache, filePath, contents);
        return { imports, css: rtlcss.process(css) };
      };
    }

rtlcss

Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)

MIT
Latest version published 8 months ago

Package Health Score

75 / 100
Full package analysis