Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mingelz/combohtml

Combo your HTML files, make scripts(.js) and stylesheets(.css) inline.
https://github.com/mingelz/combohtml

Last synced: about 1 month ago
JSON representation

Combo your HTML files, make scripts(.js) and stylesheets(.css) inline.

Awesome Lists containing this project

README

        

# ComboHTML

[![Version](https://img.shields.io/npm/v/combohtml.svg?style=flat)](https://www.npmjs.com/package/combohtml)

Combo your HTML files, make scripts(.js) and stylesheets(.css) inline.

## Quick start

There are 3 directives: `inline`, `compress`, `remove`, and support all HTML tags.

* if the tag is ``, ``, or `<script>`, it's accepted all 3 directives,
* otherwise it's accepted `compress` and `remove`

```html
<!-- inline remote file only -->
<link data-combohtml="inline" rel="stylesheet" href="//example.com/index.css">

<!-- inline and compress local file -->
<script data-combohtml="inline,compress" src="./index.js"></script>

<!-- compress inline code -->
<style data-combohtml="compress">
div {
color: #000;
}

function test (whatever) {
var one = 1
return one + whatever
}

mock = "the mock data in development environment"


whatever...

```

## Install

First, make sure your Node.js `>= 4`.

```shell
npm install combohtml
```

## Command line usage

```shell
# process specified file
combohtml -i index.html -o dist.html

# process mutiple files
combohtml --input 'src/**/*.html' --output dist
```

### Command line options

```shell
-i, --input Input file(s)
-o, --output Output directory or file name
-r, --root [root] Files root path,
default to current working directory (process.cwd())
-a, --attr [attr] Specified attribute,
default to "data-combohtml"
```