From f35f5b4a42be1bd1e132f32a7e8ce987a93b330a Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 15 Jun 2018 00:25:31 +0200 Subject: [PATCH] Complete comments --- generate.js | 5 +++++ 1 file changed, 5 insertions(+) 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) }