diff --git a/src/components/Home.scss b/src/components/Home.scss index 8b0de37..d485e2c 100644 --- a/src/components/Home.scss +++ b/src/components/Home.scss @@ -1,7 +1,7 @@ @import "../../config/variables.scss"; #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; -moz-background-size: cover; diff --git a/src/utils/scanner.js b/src/utils/scanner.js index 036abcb..23ab646 100644 --- a/src/utils/scanner.js +++ b/src/utils/scanner.js @@ -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) { const filePath = path.join(process.cwd(), config.contentPath, file) const metadata = this.fileMetadata(filePath) @@ -104,11 +109,22 @@ export class Scanner { (files) => { const filtered = files.filter( (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' ) - ) - return Promise.all(filtered.map(this.readfile)) + ) + + return Promise.all(posts.map(this.readfile)) } ).then( (files) => {