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;
|
||||
Reference in New Issue
Block a user