UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

39 lines (28 loc) 1.26 kB
'use strict'; const { applyIconClassRename } = 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 = applyIconClassRename(content); return match.replace(content, updated); }); result = result.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, (match, content) => { const updated = applyIconClassRename(content); return match.replace(content, updated); }); result = result.replace(/class=["'`]([^"'`]*?)["'`]/gi, (match, classValue) => { const updated = applyIconClassRename(classValue); return match.replace(classValue, updated); }); return result !== fileInfo.source ? result : undefined; }; module.exports.aiInstructions = `Icon CSS classes were renamed in Kendo UI 2019 R1. This codemod updates icon class references in HTML files — including class attributes and inline style/script blocks. Before: <span class="k-icon-zoom-in"></span> <i class="k-icon-home"></i> After: <span class="k-icon k-i-zoom-in"></span> <i class="k-icon k-i-home"></i>`;