feat: adds scully

This commit is contained in:
Markus Huggler
2020-11-10 21:11:35 +01:00
parent 7f72252f33
commit ed22dcf5a4
30 changed files with 2078 additions and 355 deletions

View File

@@ -0,0 +1,14 @@
const {registerPlugin} = require('@scullyio/scully');
const FixStaticLinksPlugin = 'fixStaticLinks';
const fixStaticLinksPlugin = async (html) => {
const regex = new RegExp('(<a[^>]* href="\/)([^"]*)"', 'gmi');
html = html.replace(regex, `$1${process.env.LOCALE}/$2"`);
return Promise.resolve(html);
};
registerPlugin('router', 'fixStaticLinks', fixStaticLinksPlugin);
exports.FixStaticLinksPlugin = FixStaticLinksPlugin;

11
scully/plugins/plugin.js Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.myPlugin = void 0;
const scully_1 = require("@scullyio/scully");
exports.myPlugin = 'myPlugin';
const myFunctionPlugin = async (html) => {
return html;
};
const validator = async () => [];
scully_1.registerPlugin('render', exports.myPlugin, myFunctionPlugin, validator);
//# sourceMappingURL=plugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["plugin.ts"],"names":[],"mappings":";;;AACA,6CAAmE;AAEtD,QAAA,QAAQ,GAAG,UAAU,CAAC;AAEnC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAY,EAAmB,EAAE;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;AAEjC,uBAAc,CAAC,QAAQ,EAAE,gBAAQ,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC"}

12
scully/plugins/plugin.ts Normal file
View File

@@ -0,0 +1,12 @@
import { registerPlugin, getPluginConfig } from '@scullyio/scully';
export const myPlugin = 'myPlugin';
const myFunctionPlugin = async (html: string): Promise<string> => {
return html;
};
const validator = async () => [];
registerPlugin('render', myPlugin, myFunctionPlugin, validator);