Complete comments
This commit is contained in:
parent
7ffc1dbbe5
commit
f35f5b4a42
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue