MCPcopy Create free account
hub / github.com/MohammadYounes/rtlcss / processCSSFile

Function processCSSFile

bin/rtlcss.js:60–101  ·  view source on GitHub ↗
(error, data, outputName)

Source from the content-addressed store, hash-verified

58}
59
60function 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
103function walk (dir, done) {
104 fs.readdir(dir, (error, list) => {

Callers 2

walkFunction · 0.85
mainFunction · 0.85

Calls 3

printErrorFunction · 0.85
printWarningFunction · 0.85
printInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…