ghost-static
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -31,19 +31,17 @@ #!/usr/bin/env node | ||
*/ | ||
registerAction('onResourceSaved', ({ resource }) => { | ||
registerAction('onResourceSaved', async ({ resource }) => { | ||
let resPath = path.join(scraper.tmpFolder, resource.filename) | ||
isBinary(resPath, (err, result) => { | ||
if (err) throw err | ||
if (!result) { | ||
try { | ||
let data = fs.readFileSync(resPath, 'utf8') | ||
let result = data.replace( | ||
new RegExp(scraper.localURL, 'g'), | ||
scraper.publishURL | ||
) | ||
fs.writeFileSync(resPath, result, 'utf8') | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
const binary = await isBinary(fs.readFileSync(resPath)) | ||
if (!binary) { | ||
try { | ||
let data = fs.readFileSync(resPath, 'utf8') | ||
let result = data.replace( | ||
new RegExp(scraper.localURL, 'g'), | ||
scraper.publishURL | ||
) | ||
fs.writeFileSync(resPath, result, 'utf8') | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
}) | ||
} | ||
}) | ||
@@ -78,3 +76,3 @@ | ||
urls: [this.localURL], | ||
plugins: [new RewritterPlugin(this.tmpFolder, this.publishURL)], | ||
plugins: [new RewritterPlugin()], | ||
requestConcurrency: 1, | ||
@@ -81,0 +79,0 @@ directory: this.tmpFolder, |
{ | ||
"name": "ghost-static", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A tool to convert you Ghost blog to a static website", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4193890
57
319