@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
32 lines (22 loc) • 1.07 kB
JavaScript
;
const { transformTileLayoutHeaderSelector } = require('../_shared.cjs');
module.exports = function transformer(fileInfo) {
if (!/\.(html|htm|aspx|cshtml|vbhtml|hbs|handlebars)$/i.test(fileInfo.path)) {
return undefined;
}
let result = fileInfo.source;
result = result.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi, (match, content) => {
const updated = transformTileLayoutHeaderSelector(content);
return match.replace(content, updated);
});
result = result.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, (match, content) => {
const updated = transformTileLayoutHeaderSelector(content);
return match.replace(content, updated);
});
return result !== fileInfo.source ? result : undefined;
};
module.exports.aiInstructions = `The TileLayout header element changed from h5 to div in Kendo UI 2021 R2. This codemod updates inline <style> and <script> blocks in HTML files.
Before:
<style>.k-tilelayout-header h5 { font-size: 14px; }</style>
After:
<style>.k-tilelayout-header div { font-size: 14px; }</style>`;