cssx-framework
Advanced tools
Comparing version
{ | ||
"name": "cssx-framework", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "A CSS driven web framework that compiles semi-standard CSS into HTML content + styles at runtime", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
export class CHARS { | ||
static SPACE = ' ' | ||
static NEWLINE = '\n' | ||
static RETURN = '\r' | ||
static DOT = '.' | ||
@@ -5,0 +6,0 @@ static COMMA = ',' |
@@ -79,4 +79,12 @@ import { htmlElementAttributes } from 'html-element-attributes' | ||
if (obj.type === 'element') { | ||
// Take only the last value for each attribute to remove duplicates | ||
var attrsObj = obj.attrs.reduce((acc, attr) => ({...acc, [attr.name]: attr.value}), {}) | ||
// For regular attributes, take only the last value for each attribute to remove duplicates | ||
// For event attributes, combine all values into a single concatenated string to allow multi-line functions | ||
var attrsObj = obj.attrs.reduce((acc, attr) => ( | ||
{ | ||
...acc, | ||
[attr.name]: acc.hasOwnProperty(attr.name) && htmlEventAttributes.includes(attr.name) | ||
? `${acc[attr.name]} ${attr.value}` | ||
: attr.value | ||
} | ||
), {}) | ||
returnText = `${CHARS.LESS_THAN}${obj.value} ${Object.entries(attrsObj).map(([name, value]) => `${name}="${replaceVariables(value, vars)}"`).join(CHARS.SPACE)}${CHARS.GREATER_THAN}` | ||
@@ -83,0 +91,0 @@ returnElementTag = `${CHARS.LESS_THAN}${CHARS.SLASH}${obj.value}${CHARS.GREATER_THAN}` |
@@ -96,3 +96,3 @@ import { readFileSync } from 'fs' | ||
overrideParams(newMixin, params) | ||
parent.children.push( | ||
@@ -99,0 +99,0 @@ ...newMixin.children |
22962
1.79%434
2.12%