Comparing version 0.1.0 to 0.2.0
17
core.js
@@ -52,3 +52,2 @@ import { readFileSync } from 'fs' | ||
const className = `cssx-${generateHash(elementTag + node.source?.start.line)}` | ||
props.class = className | ||
@@ -79,2 +78,7 @@ let elementStyles = '' | ||
} | ||
} else if (decl.prop === '--content') { | ||
const value = decl.value.replace(/var\((--\w+)\)/g, (_, key) => { | ||
return elementVars[key] || decl.value | ||
}) | ||
props.content = elementTag !== 'code' ? md.render(value.replace(/^["']|["']$/g, '')) : value.replace(/^["']|["']$/g, '') | ||
} else { | ||
@@ -89,9 +93,2 @@ elementVars[decl.prop] = decl.value | ||
} else { | ||
if (decl.prop === 'content') { | ||
const value = decl.value.replace(/var\((--\w+)\)/g, (_, key) => { | ||
return elementVars[key] || decl.value | ||
}) | ||
props[decl.prop] = elementTag !== 'code' ? md.render(value.replace(/^["']|["']$/g, '')) : value.replace(/^["']|["']$/g, '') | ||
return | ||
} | ||
elementStyles += `${decl.prop}: ${decl.value};\n` | ||
@@ -113,5 +110,7 @@ } | ||
props.class = `${className} ${props.class ?? ''}`.trim() | ||
const propsParser = (props) => { | ||
return Object.keys(props).reduce((acc, key) => { | ||
if (key === 'content') { | ||
if (key === '--content') { | ||
return acc | ||
@@ -118,0 +117,0 @@ } |
{ | ||
"name": "cssx-build", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Compile CSS as a programming language", | ||
"author": "salteadorneo", | ||
"license": "MIT", | ||
"homepage": "https://cssx.js.org/", | ||
"homepage": "https://cssx.js.org", | ||
"repository": { | ||
@@ -20,3 +20,9 @@ "type": "git", | ||
"language", | ||
"css" | ||
"css", | ||
"preprocessor", | ||
"compiler", | ||
"build", | ||
"tool", | ||
"cli", | ||
"postcss" | ||
], | ||
@@ -57,2 +63,2 @@ "type": "module", | ||
} | ||
} | ||
} |
19555
487