1
Fork 0
userstyles/generate.js

22 lines
660 B
JavaScript
Executable File

// Generates all *.user.css styles.
// Require dependencies
// const fs = require('fs')
const klawSync = require('klaw-sync')
const path = require('path')
const userCss = require('usercss-creator')
// Define constants
const stylesDirectory = path.join(__dirname, 'styles')
const cssDirectory = path.join(__dirname, 'css')
let files = klawSync(stylesDirectory, {nodir: true})
files = files.filter(file => path.extname(file.path) === '.js')
for (const file of files) {
const descriptor = require(file.path)
const cssPath = path.join(cssDirectory, descriptor.folder, descriptor.entry)
userCss.create(cssPath, descriptor.options)
}