https://github.com/reshape/reshape-cli
CLI for reshape
https://github.com/reshape/reshape-cli
Last synced: about 1 year ago
JSON representation
CLI for reshape
- Host: GitHub
- URL: https://github.com/reshape/reshape-cli
- Owner: reshape
- License: mit
- Created: 2017-01-13T05:13:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T19:04:44.000Z (almost 6 years ago)
- Last Synced: 2025-04-04T23:08:41.342Z (about 1 year ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# reshape-cli
> Simple CLI for [reshape][reshape-url]
[]()[![NPM version][npm-image]][npm-url][](https://travis-ci.org/GitScrum/reshape-cli)[![AppVeyor Build Status][appveyor-img]][appveyor][![Coveralls Status][coveralls-image]][coveralls-url][![Dependency Status][depstat-image]][depstat-url][![Standard Code Style][style]][style-url]
## Install
```
npm install --global reshape-cli
```
## Usage
```bash
$ reshape --help
Usage
reshape [-o output-file/directory|-r] [-i input-file/directory] [--config|-c path/to/file/config] [--use|-u plugin]
Options
--config, -c Path to JS file [string]
--output, -o Output html file/folder result [required]
--input, -i Input html file/folder [required]
--use, -u reshape plugin name [string]
--replace, -r Replace input file(s) [boolean]
--help, -h Show help [boolean]
--version, -v Show version number [boolean]
```
## Config
*Automatically loads plug-ins with configuration from package.json using [post-load-plugins](https://github.com/post-org/post-load-plugins)*
package.json
```json
{
"name": "my project",
"dependencies": {
"reshape-include": "^1.0.2"
},
"reshape": {
"include": {
"root": "./"
}
}
}
```
## Sample example
1. Create config in `package.json`
```json
{
"name": "my project",
"dependencies": {
"reshape-include": "^1.0.2"
},
"reshape": {
"include": {
"root": "./"
}
}
}
```
2. Create `index.html`
```html
Here's my partial:
after the partial
```
3. Create `_partial.html`
```html
hello from the partial!
```
4. Run the command in the terminal
```bash
$ reshape -i path/to/input/index.html -o pat/to/output/result.html
```
*Will be automatically found plugin `reshape-include` assembled configuration for it `{ "root": "./"}` and it will be initialized.*
5. Enjoy `result.html`
```html
Here's my partial:
hello from the partial!
after the partial
```
## Options
### `config`
config.js
```js
module.exports = {
parser: require('sugarml'),
plugins: {
include: {
root: './'
}
}
};
```
```bash
$ reshape -o output.html -i input.html -c config.js
```
--
### `use`
```bash
$ reshape
-o output.html
-i input.html
-c config.js
-u reshape-custom-elements
```
--
### `dir`
```bash
$ reshape -o outputFolder/ -i inputFolder/*.html
```
```bash
$ reshape -o outputFolder/ -i inputFolder/**/*.html
```
--
### `replace`
```bash
$ reshape -i input.html -r
```
```bash
$ reshape -i inputFolder/*.html -r
```
### License [MIT](license)
[reshape-url]: http://github.com/reshape/reshape
[npm-url]: https://npmjs.org/package/reshape-cli
[npm-image]: http://img.shields.io/npm/v/reshape-cli.svg?style=flat-square
[travis-url]: https://travis-ci.org/GitScrum/reshape-cli
[travis-image]: http://img.shields.io/travis/GitScrum/reshape-cli/master.svg?style=flat-square&label=unix
[appveyor]: https://ci.appveyor.com/project/GitScrum/reshape-cli
[appveyor-img]: https://img.shields.io/appveyor/ci/GitScrum/reshape-cli/master.svg?style=flat-square&label=windows
[coveralls-url]: https://coveralls.io/r/GitScrum/reshape-cli
[coveralls-image]: http://img.shields.io/coveralls/GitScrum/reshape-cli.svg?style=flat-square
[depstat-url]: https://david-dm.org/GitScrum/reshape-cli
[depstat-image]: https://david-dm.org/GitScrum/reshape-cli.svg?style=flat-square
[depstat-dev-url]: https://david-dm.org/GitScrum/reshape-cli
[depstat-dev-image]: https://david-dm.org/GitScrum/reshape-cli/dev-status.svg?style=flat-square
[style-url]: https://github.com/sindresorhus/xo
[style]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square