Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/easy-team/easywebpack-html

HTML静态多页面Webpack构建工程化解决方案
https://github.com/easy-team/easywebpack-html

html html-template html-webpack-plugin nunjucks nunjucks-templates webpack

Last synced: about 2 months ago
JSON representation

HTML静态多页面Webpack构建工程化解决方案

Awesome Lists containing this project

README

        

# easywebpack-html

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/easywebpack-html.svg?style=flat-square
[npm-url]: https://npmjs.org/package/easywebpack-html
[travis-image]: https://img.shields.io/travis/hubcarl/easywebpack-html.svg?style=flat-square
[travis-url]: https://travis-ci.org/hubcarl/easywebpack-html
[codecov-image]: https://img.shields.io/codecov/c/github/hubcarl/easywebpack-html.svg?style=flat-square
[codecov-url]: https://codecov.io/github/hubcarl/easywebpack-html?branch=master
[david-image]: https://img.shields.io/david/hubcarl/easywebpack-html.svg?style=flat-square
[david-url]: https://david-dm.org/hubcarl/easywebpack-html
[snyk-image]: https://snyk.io/test/npm/easywebpack-html/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/easywebpack-html
[download-image]: https://img.shields.io/npm/dm/easywebpack-html.svg?style=flat-square
[download-url]: https://npmjs.org/package/easywebpack-html

static html webpack build for easywebpack.

- support static html template
- support nunjucks html template

## Version

- easywebpack ^4.x.x > webpack 4.x.x
- easywebpack ^3.x.x > webpack 3.x.x

## Install

```bash
$ npm i easywebpack-html --save-dev
```

## Usage

```js
// build/index.js
const HtmlWebpack = require('easywebpack-html');
const config = {
entry: {
index: './src/index.js'
},
template: 'view/layout.html'
};

if (process.env.NODE_SERVER) {
// development mode: webpack building and start webpack hot server
HtmlWebpack.server(config);
} else {
// webpack build file to disk
HtmlWebpack.build(config);
}
```

## Run

```js
{
"scripts": {
"build": "cross-env NODE_ENV=development node build",
"start" : "cross-env NODE_SERVER=true NODE_ENV=development node build"
}
}
```

```bash

npm start

```

## Example

- [easywebpack-multiple-html-boilerplate](https://github.com/hubcarl/easywebpack-multiple-html-boilerplate) Multiple static html build boilerplate.

- you can use [easywebpack-cli](https://github.com/hubcarl/easywebpack-cli) create multiple static html build boilerplate.