# htm-cli

> html scss css img template project

Latest version **1.2.1** (published 2018-01-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install htm-cli
pnpm add htm-cli
yarn add htm-cli
bun add htm-cli
```

Provides the command `htm`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-01-13 |
| First published | 2017-12-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | perfey |
| Maintainers | perfey7891 |
| Keywords | html, scss, css, img, sprite |

## Links

- npm: https://www.npmjs.com/package/htm-cli
- Repository: https://github.com/perfey/htm-cli
- Homepage: https://github.com/perfey/htm-cli/blob/master/README.md
- Issues: https://github.com/perfey/htm-cli/issues
- npm.io page: https://npm.io/package/htm-cli

## Dependencies (4)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [inquirer](https://npm.io/package/inquirer.md) ^3.0.6
- [commander](https://npm.io/package/commander.md) ^2.9.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2018-01-13
- 1.2.0 — 2018-01-13
- 1.1.0 — 2017-12-05
- 1.0.1 — 2017-12-03
- 1.0.0 — 2017-12-02

## README

# htm-cli

简单html页面开发初始化脚手架

## 安装

```shell
npm install -g htm-cli
```

## 配置

为了保证使用方便，需要全局安装node-sass
```shell
npm install -g node-sass
```

## 使用

### 新建项目

```shell
htm create
```

参数说明：
```shell
  -n, --name [name]         项目名
  -t, --type [type]         项目类型：html(默认) ejs
```

创建完毕项目后，进入项目跟目录`npm install`安装依赖，即可开始开发

## 开发项目

在项目内执行npm script即可

### sass编译

```shell
npm run sass
```
监控`scss`文件夹，编译到`css`文件夹

### ejs编译

```shell
npm run ejs:watch
```
监控`ejs`文件夹内的*.ejs，编译到`html`文件夹

### 打包项目

```shell
npm run publish
```
合并雪碧图，图片base64 inline到css

## 说明

### 项目目录
雪碧图需要放在slice目录
需要inline到css的图片，在slice目录新建inline文件夹，把图片放进去即可
雪碧图可以区分合并，slice目录下新建文件夹可以合并为新的雪碧图

### 图片压缩
使用 [image-minify] 实现图片压缩功能，png图片压缩效果比较令人满意，默认会开启png图片压缩
```javascript
imageMinCheck: false, // 检查图片是否压缩了
imageMinify: {  // 图片压缩配置
  // spritePngOnly: true, // 只压缩png格式的雪碧图
  png: true,  // 压缩png格式的图片
  jpg: false  // 压缩jpg格式的图片
}
```

如果极致要求，可以采用手动压缩的方式，项目配置如下
```javascript
imageMinCheck: true, // 检查图片是否压缩了
imageMinify: false,  // 图片压缩配置
```
手动压缩图片推荐 [tinypng] 或者 [optimizilla]   
合并完成的雪碧图，会生成在publish目录，把雪碧图压缩后放到`./generate_sprite/min`目录，再运行`npm run publish`即可自动替换publish目录的雪碧图为压缩后的资源，如果雪碧图没有调整就无需每次`publish`都重复压缩雪碧图  


[image-minify]: https://github.com/perfey/image-minify
[tinypng]: https://tinypng.com/
[optimizilla]: http://optimizilla.com/zh/

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