MCPcopy Create free account
hub / github.com/chokcoco/iCSS / assessDifficulty

Method assessDifficulty

MCP/scripts/fetch-inspiration.js:277–304  ·  view source on GitHub ↗
(cssContent, htmlContent)

Source from the content-addressed store, hash-verified

275 }
276
277 assessDifficulty(cssContent, htmlContent) {
278 let complexity = 0;
279
280 // 基于 CSS 复杂度评估
281 const advancedProperties = [
282 '@keyframes', 'transform3d', 'perspective', 'clip-path',
283 'mask', 'filter', 'mix-blend-mode', 'calc(', 'var(',
284 'custom-property', '@property'
285 ];
286
287 advancedProperties.forEach(prop => {
288 if (cssContent.includes(prop)) {
289 complexity += 2;
290 }
291 });
292
293 // 基于嵌套和选择器复杂度
294 const selectorComplexity = (cssContent.match(/::?[\w-]+/g) || []).length;
295 complexity += Math.floor(selectorComplexity / 5);
296
297 // 基于动画复杂度
298 const animationCount = (cssContent.match(/@keyframes/g) || []).length;
299 complexity += animationCount * 3;
300
301 if (complexity < 5) return '初级';
302 if (complexity < 10) return '中级';
303 return '高级';
304 }
305
306 assessBrowserSupport(cssContent) {
307 const support = {

Callers 1

parseMarkdownContentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected