mirror of
https://gitlab.com/novaloop-oss/angular/localization.git
synced 2025-12-06 04:51:52 +00:00
15 lines
433 B
JavaScript
15 lines
433 B
JavaScript
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;
|