https://github.com/indus/gluex
glue your stuff together
https://github.com/indus/gluex
cli combine fuse nodejs npm packager
Last synced: 2 months ago
JSON representation
glue your stuff together
- Host: GitHub
- URL: https://github.com/indus/gluex
- Owner: indus
- License: mit
- Created: 2017-05-09T06:52:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-31T09:08:27.000Z (about 9 years ago)
- Last Synced: 2025-03-16T09:42:33.615Z (about 1 year ago)
- Topics: cli, combine, fuse, nodejs, npm, packager
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gluex
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gluex
*glue your stuff together*
> GLUEX is a tool to glue multiple HTML, JavaScript or JSON files (or other file types) together. It lets you use selectors to only pick a certain tag from a HTML document or a certain property from a JSON. Furthermore it allows the usage of namespaces, for example to distinguish between a development and a productive scenario. It could be used as a CLI tool as well as a module in your code.
## Installation
as a command line tool
```
npm install gluex -g
```
as a module
```
npm install gluex --save
```
## Usage
GLUEX uses inline comment-based directives to determine which files you'd like to glue.
### In a JavaScript file
``` JS
// @gluex path/to/file.js
```
or
``` JS
/* @gluex path/to/file.js */
```
### In a HTML file
``` HTML
```
### invoke as a CLI tool
to glue just once:
gluex -i path/to/input.xx -o path/to/output.xx
to watch files for changes:
gluex -i path/to/input.xx -o path/to/output.xx -w
When watching, GLUEX will automatically watch any referenced files for changes too, and recompile the output file upon any changes to reference files.
### invoke as a module
``` JS
var gluex = require("gluex"),
inputPath = "path/to/input.xx",
outputPath = "path/to/output.xx",
namespace = null,
watch = true,
gluex(inputPath, outputPath, namespace, watch);
```
if you omit the `outputPath` the glued file gets returned by the function like so...
``` JS
var output = gluex(inputPath);
```
## Advanced Usage
### Namespaces
``` HTML
```
When calling gluex with the namespace `dev` the first directive will be replaced with an empty string (deleted) and only the second one will be replaced with the content of the refernced file. Calling with no namespace will replace both comments and remove none. This works the same for JS. You can pass a namespace like so:
#### CLI
gluex -i path/to/input.xx -o path/to/output.xx -n dev
#### Module
``` JS
gluex('path/to/input.xx', 'path/to/output.xx', 'dev');
```
### Selectors
``` HTML
```
For JSON and HTML includes you can put a selectors behind the filename (in brackets). For a JSON file the selector has to be a property path. For a HTML file you can use any CSS selector.
## License
**MIT License**
Copyright (c) 2017 Stefan Keim (indus)