mirror of
https://gitlab.com/novaloop-oss/angular/localization.git
synced 2025-12-06 04:51:52 +00:00
feat: adds scully
This commit is contained in:
14
scully/plugins/fixStaticLinks.js
Normal file
14
scully/plugins/fixStaticLinks.js
Normal 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
11
scully/plugins/plugin.js
Normal 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
|
||||
1
scully/plugins/plugin.js.map
Normal file
1
scully/plugins/plugin.js.map
Normal 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
12
scully/plugins/plugin.ts
Normal 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);
|
||||
Reference in New Issue
Block a user