Skip to content

Commit

Permalink
feat: support less lang
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangmo8 committed Oct 16, 2024
1 parent edf147a commit 0cfcea7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions playground/src/components/extension/Exports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ const langs = reactive<{
lang: 'scss',
formater: formaters.formatToSass,
},
{
icon: 'i-logos-less',
name: 'Less',
parser: 'less',
lang: 'less',
formater: formaters.formatToLess,
},
{
name: 'JSON',
icon: 'i-logos-json',
Expand Down
1 change: 1 addition & 0 deletions playground/src/composables/shiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const shiki = computedAsync<HighlighterCore>(async (onCancel) => {
() => import('shiki/langs/javascript.mjs'),
() => import('shiki/langs/json.mjs'),
() => import('shiki/langs/scss.mjs'),
() => import('shiki/langs/less.mjs'),
() => import ('shiki/langs/css.mjs'),
],
})
Expand Down
8 changes: 8 additions & 0 deletions playground/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ export function formatToSass(colors: ThemeMetas): string {
}
return scss
}

export function formatToLess(colors: ThemeMetas): string {
let less = ''
for (const [key, value] of Object.entries(colors)) {
less += `@color-${key}: ${value};\n`
}
return less
}

0 comments on commit 0cfcea7

Please sign in to comment.