Scan images
This commit is contained in:
parent
b2d56cf254
commit
e20d5c9697
|
@ -1,7 +1,7 @@
|
||||||
@import "../../config/variables.scss";
|
@import "../../config/variables.scss";
|
||||||
|
|
||||||
#coverPage {
|
#coverPage {
|
||||||
background: url(../../config/background.jpg) no-repeat center center fixed;
|
background: url('/static/background.jpg') no-repeat center center fixed;
|
||||||
|
|
||||||
-webkit-background-size: cover;
|
-webkit-background-size: cover;
|
||||||
-moz-background-size: cover;
|
-moz-background-size: cover;
|
||||||
|
|
|
@ -38,6 +38,11 @@ export class Scanner {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processImage (filename) {
|
||||||
|
const filePath = path.join(process.cwd(), config.contentPath, filename)
|
||||||
|
fs.copyFileSync(filePath, path.join(process.cwd(), 'public/static', filename))
|
||||||
|
}
|
||||||
|
|
||||||
processFile (file, data) {
|
processFile (file, data) {
|
||||||
const filePath = path.join(process.cwd(), config.contentPath, file)
|
const filePath = path.join(process.cwd(), config.contentPath, file)
|
||||||
const metadata = this.fileMetadata(filePath)
|
const metadata = this.fileMetadata(filePath)
|
||||||
|
@ -104,11 +109,22 @@ export class Scanner {
|
||||||
(files) => {
|
(files) => {
|
||||||
const filtered = files.filter(
|
const filtered = files.filter(
|
||||||
(file) => (
|
(file) => (
|
||||||
fs.statSync(path.join(process.cwd(), config.contentPath, file)).isFile() &&
|
fs.statSync(path.join(process.cwd(), config.contentPath, file)).isFile()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
const images = filtered.filter(
|
||||||
|
(file) => (
|
||||||
|
path.extname(file) == '.jpg' || path.extname(file) == '.png' || path.extname(file) == '.gif'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
images.map(this.processImage)
|
||||||
|
const posts = filtered.filter(
|
||||||
|
(file) => (
|
||||||
path.extname(file) == '.md'
|
path.extname(file) == '.md'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return Promise.all(filtered.map(this.readfile))
|
|
||||||
|
return Promise.all(posts.map(this.readfile))
|
||||||
}
|
}
|
||||||
).then(
|
).then(
|
||||||
(files) => {
|
(files) => {
|
||||||
|
|
Loading…
Reference in New Issue