# @spearly/cms-js-core

> [日本語](./README_ja.md)

Latest version **1.0.19** (published 2025-03-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @spearly/cms-js-core
pnpm add @spearly/cms-js-core
yarn add @spearly/cms-js-core
bun add @spearly/cms-js-core
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.19 |
| Published | 2025-03-13 |
| First published | 2022-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Unimal.jp |
| Maintainers | mantaroh-npm, qst-exe, akoarum |

## Links

- npm: https://www.npmjs.com/package/@spearly/cms-js-core
- Repository: https://github.com/unimal-jp/spear
- Homepage: https://github.com/unimal-jp/spear#readme
- Issues: https://github.com/unimal-jp/spear/issues
- npm.io page: https://npm.io/package/@spearly/cms-js-core

## Dependencies (2)

- [@spearly/sdk-js](https://npm.io/package/@spearly/sdk-js.md) ^2.0.3
- [node-html-parser](https://npm.io/package/node-html-parser.md) ^6.1.4

## Recent versions

- 1.0.19 (latest) — 2025-03-13
- 1.0.18 — 2023-09-07
- 1.0.17 — 2023-09-03
- 1.0.16 — 2023-08-29
- 1.0.15 — 2023-08-17
- 1.0.14 — 2023-08-09
- 1.0.13 — 2023-08-02
- 1.0.12 — 2023-07-31
- 1.0.11 — 2023-07-21
- 1.0.10 — 2023-07-20
- 1.0.9 — 2023-03-23
- 1.0.8 — 2023-03-14
- 1.0.7 — 2023-03-10
- 1.0.6 — 2023-03-07
- 1.0.5 — 2023-02-15
- … 4 more at https://npm.io/package/@spearly/cms-js-core/versions

## README

[日本語](./README_ja.md)

# Spearly CMS JS Core module

## Feature

- Generate converted html string from specified html template string.
- Fetch content data.

## Concept : DO NOT MANIPULATE THE DOM

- This module **SHOULD NOT** use Browser DOM Manipulation.
  - This module should out of DOM world.
  - This module should use pure JavaScript.
  - Internally, this core library use html parser in order to search sub-loop element.

## Spec

### `generateContent`

`generateContent` will generate the one content html string from fetched data.

Params:

- templateHtml : template html string which using generate the html. This html string **SHOULD NOT** contain `cms-item` attributes. This mean that pass the innerHTML of element which has `cms-item`.
- contentId : Specify the content id want to fetch. or You can specify alias id.

Return:

- Generated content as html string.

Error:

- Throws Error when generator doesn't fetch or convert.

---
_Source: https://npm.io/package/@spearly/cms-js-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
