push plugins as submodule

This commit is contained in:
patarapolw committed 2019-08-12 01:34:35 +07:00
1 parent a9b6fd060b
commit aa6e97b54b
5 files changed
+1 -208

No files matched your search

@@ -0,0 +1,8 @@
{
"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"
}
+13
View File
@@ -0,0 +1,13 @@
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);
})
}
}