Skip to content

Commit a7dd503

Browse files
committed
feat(new tool): CSS Prettier
CSS Prettier
1 parent 21fa721 commit a7dd503

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script setup lang="ts">
2+
import beautify from 'js-beautify';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
5+
const inputCSS = ref('');
6+
const outputCSS = computed(() => {
7+
return beautify.css(inputCSS.value, {
8+
indent_char: ' ',
9+
indent_size: 2,
10+
sep: '\n',
11+
});
12+
});
13+
</script>
14+
15+
<template>
16+
<div>
17+
<c-input-text
18+
v-model:value="inputCSS"
19+
multiline raw-text
20+
placeholder="Your CSS content..."
21+
rows="8"
22+
autofocus
23+
label="Your CSS to format (can paste from clipboard):"
24+
/>
25+
26+
<n-divider />
27+
28+
<n-form-item label="Output prettified CSS:">
29+
<TextareaCopyable
30+
:value="outputCSS"
31+
multiline
32+
language="css"
33+
word-wrap
34+
/>
35+
</n-form-item>
36+
</div>
37+
</template>

src/tools/css-prettifier/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BrandCss3 } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Css prettifier',
6+
path: '/css-prettifier',
7+
description: 'CSS Prettify',
8+
keywords: ['css', 'prettifier', 'beautify', 'prettier', 'format'],
9+
component: () => import('./css-prettifier.vue'),
10+
icon: BrandCss3,
11+
createdAt: new Date('2024-03-15'),
12+
});

src/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { tool as asciiTextDrawer } from './ascii-text-drawer';
66

77
import { tool as textToUnicode } from './text-to-unicode';
88
import { tool as safelinkDecoder } from './safelink-decoder';
9+
import { tool as cssPrettifier } from './css-prettifier';
910
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
1011
import { tool as numeronymGenerator } from './numeronym-generator';
1112
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -148,6 +149,7 @@ export const toolsByCategory: ToolCategory[] = [
148149
dockerRunToDockerComposeConverter,
149150
xmlFormatter,
150151
yamlViewer,
152+
cssPrettifier,
151153
],
152154
},
153155
{

0 commit comments

Comments
 (0)