# xtyle-server

> Xtyle Util Server

Latest version **0.1.3** (published 2023-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install xtyle-server
pnpm add xtyle-server
yarn add xtyle-server
bun add xtyle-server
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-12-19 |
| First published | 2023-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 36.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hlop3z |
| Maintainers | hlop3z |

## Links

- npm: https://www.npmjs.com/package/xtyle-server
- npm.io page: https://npm.io/package/xtyle-server

## Dependencies (7)

- [sass](https://npm.io/package/sass.md) ^1.69.5
- [terser](https://npm.io/package/terser.md) ^5.24.0
- [cssnano](https://npm.io/package/cssnano.md) ^6.0.0
- [express](https://npm.io/package/express.md) ^4.18.2
- [postcss](https://npm.io/package/postcss.md) ^8.4.23
- [@swc/core](https://npm.io/package/@swc/core.md) ^1.3.99
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^10.4.14

## Recent versions

- 0.1.3 (latest) — 2023-12-19
- 0.1.2 — 2023-12-03
- 0.1.1 — 2023-11-27
- 0.1.0 — 2023-11-27

## README

# xtyle-server

Xtyle Util Server

## Install

```sh
npm i xtyle-server
```

## File | `index.js`

```js
import xtyle from "xtyle-server";

const port = process.env.PORT || 3000;

xtyle.server(port);
```

## File | `package.json`

```json
{
  "scripts": {
    "app": "node index.js"
  }
}
```

## Utils

```js
import xtyle from "xtyle-server";

xtyle.minify(`/* JS CODE */`);
xtyle.tsx(`/* TSX Render */`);
xtyle.css(`/* SCSS Minify */`);
```

## Component

```js
import xtyle from "xtyle-server";

const example = {
  code: `
  export default function Component(props: Props = {}) {
    return (
      <div x-html {...props} class={[$NAME, props.class]}>
        {props.children}
      </div>
    );
  }
      `,
  style: `
  $color: red;
  .#{$NAME} { color: $color; }
      `,
  props: `
  type Props = {
    class?: string | string[] | object;
    style?: string | string[] | object;
    children?: any;
  };
  
  export default Props;
      `,
  docs: `
  /**
   * Component - This is a my component.
   */
      `,
};

// Usage
xtyle.component({
  theme: "my-lib", // Optional
  name: "kebab-case-name",
  code: example.code,
  style: example.style,
  props: example.props,
  docs: example.docs,
});
```

## Plugin

```js
import xtyle from "xtyle-server";

const demoData = (name) => {
  return {
    name: name,
    code: `
  export default function Component(props: Props = {}) {
    return (
      <div x-html {...props} class={[$NAME, props.class]}>
        {props.children}
      </div>
    );
  }
      `,
    style: `
  $color: red;
  .#{$NAME} { color: $color; }
      `,
    props: `
  type Props = {
    class?: string | string[] | object;
    style?: string | string[] | object;
    children?: any;
  };

  export default Props;
      `,
    docs: `
  /**
   * Component - This is a my component.
   */
      `,
  };
};

const components = [demoData("custom-div"), demoData("button")];

const install = {
  directives: null,
  globals: null,
  store: null,
  init: `export default [() => console.log("Plugin INIT")]`,
};

xtyle.plugin({
  name: "my-lib",
  components: components,
  install: install,
});
```

---
_Source: https://npm.io/package/xtyle-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
