all files / src/ resolve-css.js

100% Statements 10/10
100% Branches 0/0
100% Functions 0/0
100% Lines 10/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17              
import { readFileSync } from 'fs'
import { join } from 'path'
import { isRelative, getRootPath } from 'ethical-utility-path'
import { generateModuleID } from 'ethical-utility-resolve-module-node'
 
const source = (path) => {
    const css = readFileSync(path, 'utf8').replace(/\'/g, '"')
    return `module.exports = '${css.trim()}'`
}
 
const resolveCSSModule = (path) => {
    const key = generateModuleID(path)
    return { key, path, source }
}
 
export default resolveCSSModule