How to use the rtlcss.configure 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 madskristensen / WebEssentials2013 / EditorExtensions / Resources / server / services / srv-rtlcss.js View on Github external
var processRtlCSS = function (cssContent, mapContent, sourceFileName, targetFileName, autoprefixer, autoprefixerBrowsers) {
    if (mapContent !== true) {
        mapContent = { prev: mapContent };
    }

    var result, css, map;
    try {
        var config = configLoader.load(null, path.dirname(sourceFileName), { options: { minify: false } });

        result = rtlcss.configure(config).process(cssContent, {
            map: mapContent,
            from: sourceFileName,
            to: targetFileName
        });

        css = result.css;
        map = result.map.toJSON();
    } catch (e) {
        // Return same css and map back so the upstream compilers can continue.
        return {
            Success: false,
            Remarks: "RTLCSS: Exception occured: " + e.message,
            css: cssContent,
            map: mapContent
        };
    }
github MohammadYounes / grunt-rtlcss / tasks / rtlcss.js View on Github external
if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file ' + chalk.cyan(filepath) + ' not found.')
          return false
        } else {
          return true
        }
      }).map(function (filepath) {
        postcssOptions.from = filepath
        // Read file source.
        return grunt.file.read(filepath)
      })

      // RTLCSS
      postcssOptions.to = f.dest
      
      var result = rtlcss.configure({ options: options.opts, plugins: options.plugins }).process(src, postcssOptions)
      
      if (result.error) {
        grunt.fail.fatal("Could not convert: " + f.dest + " due to: " + result.error)
      }

      if (!options.saveUnmodified && result.css == src) {
        grunt.log.writeln('Skip saving unmodified file ' + chalk.cyan(f.src) + '.')
      } else {
        // Write the destination file.
        grunt.file.write(f.dest, result.css)
        
        if (!fs.existsSync(f.dest)) {
          grunt.fail.fatal("Could not create file: " + f.dest)
        }

        // Write the destination source map file.

rtlcss

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

MIT
Latest version published 4 months ago

Package Health Score

79 / 100
Full package analysis