@figma-export/output-styles-as-less
Version:
Outputter for @figma-export that exports styles to LESS
31 lines • 792 B
JavaScript
const sanitizeText = (text) => {
return text
.replace(/^[^\S\r\n]+/gm, '')
.replace(/^\*/gm, ' *')
.replace(/^"/gm, ' "');
};
const writeComment = (message) => {
return (message &&
`/**
* ${message.replace(/\*\//g, '').split('\n').join('\n * ')}
*/`);
};
export const writeVariable = (comment, name, value) => {
if (value) {
return sanitizeText(`
${writeComment(comment)}
@${name}: ${value};
`);
}
return '';
};
export const writeMap = (comment, name, value) => {
if (value) {
return sanitizeText(`
${writeComment(comment)}
#${name}() ${value};
`);
}
return '';
};
//# sourceMappingURL=utils.js.map