mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-30 11:08:58 +08:00
02a0adb872
* add ignore * Use postcss * delete themes/ * fix build script * fix css, fixed #15, fixed #13 * Add changelog * Fix horizontal scroll for code block, fixed #11 * Fix sidebar animation
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
var fs = require('fs')
|
|
var cssnano = require('cssnano').process
|
|
var resolve = require('path').resolve
|
|
var postcss = require('postcss')
|
|
|
|
var processor = postcss([require('postcss-salad')])
|
|
|
|
var saveMin = function (file, content) {
|
|
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
|
|
}
|
|
var save = function (file, content) {
|
|
fs.writeFileSync(resolve(__dirname, '../themes/', file), content)
|
|
}
|
|
var load = function (file) {
|
|
return fs.readFileSync(resolve(__dirname, '../src/themes/', file)).toString()
|
|
}
|
|
var loadLib = function (file) {
|
|
return fs.readFileSync(resolve(__dirname, '../themes/', file)).toString()
|
|
}
|
|
|
|
var list = fs.readdirSync(resolve(__dirname, '../src/themes'))
|
|
|
|
list.forEach(function (file) {
|
|
if (!/\.css$/.test(file)) return
|
|
processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
|
.then(function (result) {
|
|
save(file, result.css)
|
|
console.log('salad - ' + file)
|
|
cssnano(loadLib(file))
|
|
.then(function (result) {
|
|
saveMin(file, result.css)
|
|
console.log('cssnao - ' + file)
|
|
})
|
|
}).catch(function (err) {
|
|
console.log(err)
|
|
})
|
|
})
|
|
|