Make it possible to require and use monolith as a node module
This commit is contained in:
parent
c07f5c72ec
commit
6d0a6f6416
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env nodejs
|
||||
|
||||
'use strict'
|
||||
|
||||
var compactor = require('../compactor.js');
|
||||
var options = require('../options.js');
|
||||
|
||||
|
@ -29,7 +31,7 @@ if (process.argv.length > 2) {
|
|||
}
|
||||
|
||||
if (target) {
|
||||
compactor(target, function(error, result) {
|
||||
compactor(target, options, function(error, result) {
|
||||
console.log(result)
|
||||
})
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
var path = require('path')
|
||||
|
@ -26,7 +24,11 @@ var modules = [
|
|||
require('./modules/anchors.js').parser,
|
||||
]
|
||||
|
||||
function monolith (targetDocumentPath, callback) {
|
||||
function monolith (targetDocumentPath, _options, callback) {
|
||||
// In case monolith got included as a library
|
||||
for (var k in _options)
|
||||
options[k] = _options[k]
|
||||
|
||||
// Determine the absolute initial document path
|
||||
var absBasePath = isURL(targetDocumentPath)
|
||||
? absoluteURLPath(targetDocumentPath)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "monolith",
|
||||
"version": "0.4.5",
|
||||
"description": "Save HTML pages with ease",
|
||||
"main": "index.js",
|
||||
"main": "compactor.js",
|
||||
"dependencies": {
|
||||
"sync-request": "^3.0.1",
|
||||
"jsdom": "^9.9.1"
|
||||
|
@ -14,7 +14,11 @@
|
|||
"test": "bin/index.js https://github.com > github.html"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"hoarding",
|
||||
"save-the-internet",
|
||||
"procrastination",
|
||||
"its-mine",
|
||||
"no-more-404",
|
||||
"monolith",
|
||||
"one-for-all",
|
||||
"all-for-one"
|
||||
|
|
Loading…
Reference in New Issue