diff --git a/generate.js b/generate.js index b900d56..7141b06 100755 --- a/generate.js +++ b/generate.js @@ -10,12 +10,17 @@ const userCss = require('usercss-creator') const stylesDirectory = path.join(__dirname, 'styles') const cssDirectory = path.join(__dirname, 'css') +// Walk recursively through styles directory let files = klawSync(stylesDirectory, {nodir: true}) +// Filter out any files that aren't .js files files = files.filter(file => path.extname(file.path) === '.js') +// Iterate through all .js files for (const file of files) { + // Requiring the .js files as the descriptor of the style const descriptor = require(file.path) + // Creating the css path and generating the .user.css file with the options const cssPath = path.join(cssDirectory, descriptor.folder, descriptor.entry) userCss.create(cssPath, descriptor.options) }