UNPKG

@progress/kendo-ui

Version:

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

26 lines (19 loc) 623 B
'use strict'; const { applyAiPromptSuggestionClass } = require('../_shared.cjs'); const STYLE_RE = /(<style[^>]*>)([\s\S]*?)(<\/style>)/gi; module.exports = function transformer(fileInfo) { if (!/\.html?$/i.test(fileInfo.path)) { return undefined; } let source = fileInfo.source; let changed = false; source = source.replace(STYLE_RE, (match, open, content, close) => { const transformed = applyAiPromptSuggestionClass(content); if (transformed !== content) { changed = true; return open + transformed + close; } return match; }); return changed ? source : undefined; };