1
Fork 0

Complete comments

This commit is contained in:
Bauke 2018-06-15 00:25:31 +02:00
parent 7ffc1dbbe5
commit f35f5b4a42
No known key found for this signature in database
GPG Key ID: 2E60C4161D9ECCB2
1 changed files with 5 additions and 0 deletions

View File

@ -10,12 +10,17 @@ const userCss = require('usercss-creator')
const stylesDirectory = path.join(__dirname, 'styles') const stylesDirectory = path.join(__dirname, 'styles')
const cssDirectory = path.join(__dirname, 'css') const cssDirectory = path.join(__dirname, 'css')
// Walk recursively through styles directory
let files = klawSync(stylesDirectory, {nodir: true}) let files = klawSync(stylesDirectory, {nodir: true})
// Filter out any files that aren't .js files
files = files.filter(file => path.extname(file.path) === '.js') files = files.filter(file => path.extname(file.path) === '.js')
// Iterate through all .js files
for (const file of files) { for (const file of files) {
// Requiring the .js files as the descriptor of the style
const descriptor = require(file.path) 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) const cssPath = path.join(cssDirectory, descriptor.folder, descriptor.entry)
userCss.create(cssPath, descriptor.options) userCss.create(cssPath, descriptor.options)
} }