move base URL to repo
This commit is contained in:
1 parent
5ed3f4be3d
commit
a69aaed2c2
4 files changed
+4
-21
No files matched your search
Submodule
+1
Submodule plugins/cogear-plugin-base-url added at b7e4447eab.
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "cogear-plugin-base-url",
|
||||
"description": "Cogear.JS base URL plugin.",
|
||||
"version": "1.0.0",
|
||||
"author": "Pacharapol Withayasakpunt<patarapolw@gmail.com>",
|
||||
"homepage": "https://github.com/patarapolw/cogear-plugin-base-url",
|
||||
"main": "./plugin.js"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
module.exports = {
|
||||
apply() {
|
||||
cogear.on("build.page.writeAfter", ([page, html]) => {
|
||||
let BASE_URL = cogear.config.baseUrl || "/";
|
||||
html = html.replace(/(<link rel="stylesheet" href="|<script src=")\//g, `$1${BASE_URL}`);
|
||||
page.writePath = path.join(cogear.options.output, page.path);
|
||||
fs.writeFileSync(page.writePath, html);
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user