(error, data, outputName)
| 58 | } |
| 59 | |
| 60 | function processCSSFile (error, data, outputName) { |
| 61 | if (error) { |
| 62 | printError(`rtlcss: ${error.message}`) |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | let result |
| 67 | const opt = { map: false } |
| 68 | |
| 69 | if (input !== '-') { |
| 70 | opt.from = input |
| 71 | opt.to = output |
| 72 | } |
| 73 | |
| 74 | if (!config) { |
| 75 | printWarning('rtlcss: Warning! No config present, using defaults.') |
| 76 | result = postcss([rtlcss]).process(data, opt) |
| 77 | } else { |
| 78 | if ('map' in config === true && input !== '-') { |
| 79 | opt.map = config.map |
| 80 | } |
| 81 | |
| 82 | result = postcss([rtlcss.configure(config)]).process(data, opt) |
| 83 | } |
| 84 | |
| 85 | if (output) { |
| 86 | const savePath = directory !== true ? output : outputName |
| 87 | printInfo('Saving:', savePath) |
| 88 | |
| 89 | fs.writeFile(savePath, result.css, (err) => { |
| 90 | if (err) printError(err) |
| 91 | }) |
| 92 | |
| 93 | if (result.map) { |
| 94 | fs.writeFile(`${savePath}.map`, result.map, (err) => { |
| 95 | if (err) printError(err) |
| 96 | }) |
| 97 | } |
| 98 | } else { |
| 99 | process.stdout.write(`${result.css}\n`) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | function walk (dir, done) { |
| 104 | fs.readdir(dir, (error, list) => { |
no test coverage detected
searching dependent graphs…