#### <[...Prev](standard-functions.md "Back to Standard Functions")> <[Contents](../README.md)> <[Next...](reference.md "Next to References")>

---

## Block

Work with Blocks. It supports [Standard functions](standard-functions.md)

### 2.1

#### Block Initialization

Init new block with [disabled access](#user-content-33).
It will create different config files for different hosts.

* block.https.weblium.com.json - for `https://weblium.com`
* block.http.localhost.300.json - for `https://localhost:300`

file contents json with block id and entrypoint to future using in [commit](#3-2)

```shell
wm-cli block init --name="My block name" --entrypoint="./index.js" \
 --content=['{"color": "#ff0000"}'|@contentfilename] \
 --categories header footer
```

### 2.2

#### Block Commit

Commit changes when some change in view is occured:

```shell
wm-cli block commit
```

commit can also change content, name, categories with options:

```shell
wm-cli block commit --name="new block name" \
 --content=['{"color": "red"}'|@contentfilename]
 --categories footer
```

### 2.3

#### Block Publish/Unpublish

Enable/Disable block to public usage:

```shell
#enable block
wm-cli block publish
#disable block
wm-cli block unpublish
```

### 2.4

#### Block Purge

remove block from server and unlink [block-file](#user-content-31)

```shell
wm-cli block purge
```

### 2.5

#### Resources

Append, remove, list block's resources. See commandline help for details:

```shell
wm-cli block resource --help
```

---

<[...Prev](standard-functions.md "Back to Standard Functions")> <[Contents](../README.md)> <[Next...](reference.md "Next to References")>
