Passed
Push — main ( 006f41...5dc5e5 )
by Andrii
02:46
created

produce.ts ➔ produce   A

Complexity

Conditions 2

Size

Total Lines 9
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 9
c 0
b 0
f 0
rs 9.95
cc 2
1
import postcss from "postcss"
2
//@ts-expect-error
3
import postcssDTs = require("postcss-d-ts")
4
import {readFileSync} from "fs"
5
6
const producer = postcss([postcssDTs()])
7
8
produce([
9
  "bootstrap3/dist/css/bootstrap.css",
10
  "bootstrap4/dist/css/bootstrap.css",
11
  "material10/dist/material-components-web.css"
12
])
13
14
async function produce(sources: string[]) {
15
  for (let i = sources.length; i--;) {
16
    const p = sources[i]
17
    , name = p.replace(/\/.*$/, "")
18
    , path = require.resolve(p)
19
  
20
    await producer.process(readFileSync(path).toString(), {
21
      from: `${__dirname}/${name}.css`
22
    })  
23
  }
24
}