mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
feat(new tool): CSS Prettier
CSS Prettier
This commit is contained in:
parent
21fa7217ad
commit
a7dd50331a
3 changed files with 51 additions and 0 deletions
37
src/tools/css-prettifier/css-prettifier.vue
Normal file
37
src/tools/css-prettifier/css-prettifier.vue
Normal file
|
@ -0,0 +1,37 @@
|
|||
<script setup lang="ts">
|
||||
import beautify from 'js-beautify';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
|
||||
const inputCSS = ref('');
|
||||
const outputCSS = computed(() => {
|
||||
return beautify.css(inputCSS.value, {
|
||||
indent_char: ' ',
|
||||
indent_size: 2,
|
||||
sep: '\n',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputCSS"
|
||||
multiline raw-text
|
||||
placeholder="Your CSS content..."
|
||||
rows="8"
|
||||
autofocus
|
||||
label="Your CSS to format (can paste from clipboard):"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Output prettified CSS:">
|
||||
<TextareaCopyable
|
||||
:value="outputCSS"
|
||||
multiline
|
||||
language="css"
|
||||
word-wrap
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
</template>
|
12
src/tools/css-prettifier/index.ts
Normal file
12
src/tools/css-prettifier/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { BrandCss3 } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Css prettifier',
|
||||
path: '/css-prettifier',
|
||||
description: 'CSS Prettify',
|
||||
keywords: ['css', 'prettifier', 'beautify', 'prettier', 'format'],
|
||||
component: () => import('./css-prettifier.vue'),
|
||||
icon: BrandCss3,
|
||||
createdAt: new Date('2024-03-15'),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue