const find = require('find')
const path = require('path')
const fs = require('fs')

const sourcePath = path.resolve(__dirname, 'src')
const outputPath = path.resolve(__dirname, 'styles.js')

find.file(/\.css$/, sourcePath, (filePaths) => {
  const cssContents = filePaths.map(filePath => {
    const css = fs.readFileSync(filePath, 'utf8')
    return `\n\n/* ${filePath} */\n\n ${css}\n\n`
  })

  const final = `module.exports.ensembleStyles = \`${cssContents.join('')}\``

  fs.writeFileSync(outputPath, final, 'utf8')
})