https://github.com/roperzh/levin
Embed your CSS and JS files into your HTML page
https://github.com/roperzh/levin
css embed html inline performance web
Last synced: about 1 month ago
JSON representation
Embed your CSS and JS files into your HTML page
- Host: GitHub
- URL: https://github.com/roperzh/levin
- Owner: roperzh
- Created: 2017-06-14T12:31:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-10T17:46:21.000Z (almost 9 years ago)
- Last Synced: 2026-01-29T21:26:33.782Z (5 months ago)
- Topics: css, embed, html, inline, performance, web
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Levin
Levin finds `` and `` tags and replaces
them with the contents of the files that they link.
This is useful when you have a very small site and don't want to make two extra
requests for such a miserable number of bytes.
## Usage
**via CLI**
First, install it via npm:
```shell
$ npm install -g levin
```
Then call it via the command line. Levin receives the HTML path as a first argument
and an optional second argument if you want to customize the path in which levin
should look for the assets.
```shell
$ levin path/to/file.html [optional/path/to/assets]
```
**programatically**
First, install it via npm:
```shell
$ npm install levin
```
Then, use the `inline` function exported by levin.
```javascript
var levin = require('levin');
levin.inline('path/to/file.html', 'optional/path/to/assets', function(result) {
console.log(result);
});
```
## Why not use Harmony?
I wanted to make something kick and dirty to use on a ton of proyects that I own,
and I was lazy to implement a proper build pipeline.
## Roadmap to v0.1.0
- [x] Find `link` and `script` tags
- [x] Find the tags contents
- [x] Replace the tags contents
- [x] Add a CLI
- [ ] Optimize the code
## Roadmap for the future
- [ ] Add an option to look up for minified/unminified files
- [ ] Fetch remote files
- [ ] Batch process HTML files