{"_id":"@abutkeev/ssi","_rev":"1-fa5e2bd1151e625e4fcc994747f6d2cf","name":"@abutkeev/ssi","dist-tags":{"latest":"0.3.1"},"versions":{"0.3.1":{"name":"@abutkeev/ssi","version":"0.3.1","description":"Server Side Includes for NodeJS","author":{"name":"Chen-Heng Chang","email":"wandererm@gmail.com","url":"http://kidwm.net/"},"main":"index.js","keywords":["ssi","server side includes"],"repository":{"type":"git","url":"git+https://github.com/kidwm/node-ssi.git"},"license":"MIT","dependencies":{"glob":"^6.0.1","mkdirp":"^0.5.1"},"devDependencies":{"mocha":"^2.3.4"},"scripts":{"test":"mocha"},"gitHead":"4d8a1d27761c6607e01c773251f92c2224860cd5","bugs":{"url":"https://github.com/kidwm/node-ssi/issues"},"homepage":"https://github.com/kidwm/node-ssi#readme","_id":"@abutkeev/ssi@0.3.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-rQik6NyLwOc1mGMmaD80SZuZloZc8d8IeaXVtVkfDW2x6fDFQFVJUCFNFkO6018zmqqgqroklrZUtUorxtRdEA==","shasum":"17dfc46cbbc862762c4296e087e8db366225be6b","tarball":"https://registry.npmjs.org/@abutkeev/ssi/-/ssi-0.3.1.tgz","fileCount":41,"unpackedSize":29833,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh39efCRA9TVsSAnZWagAAgK0P/iotN26e8LJFjFj9Crw0\nRI3g/6jNmGIQwLtZzx3mbVoEMNmEDEcLIk8oTx5XbomYDqVeu3dJf4zJG/SM\nmhlY4SPh1DK/QgPg+zw0QR8wp0Rj1z+Dpj0WCkn2E+GiSHcsNrJuHUuHEBnp\nfACuUqUd2Qh5XNMFQhTnLgMnEq/0mSNzgFqYvwseZf2/yQWfpip9zWLC5wHU\nwx3g/z8QoGlXhugZrpWlquFdvqWvMGGyZlV1Cuv84ao0HvebtTCLdIfhFB7x\nR87E49DRDEaAuckeDoqisfedNwtWhRVbyM5cQPcbrFjtHDyo78fwolnR442N\niYymZWSJCY63ls/OFXMf/S0UkZGz72YjuWOVvI0m4wOxuMCC+Nu1d086V+8k\ntoCGYbiUItpCd6UtueXWwgaDu9LNh47DtVZEoyz6Yr7ytt2vIgtqDDY3chgZ\nPrTiEJUulcabQ6MUksD3gjUZjNilRGZvH+4XxioZQF8U0AmU606CfKYFt2yd\nF37+k/R0lDjiYTmQaME/RXiVbOIC0qSDRDMqOsjm5x0/0icnDkQnwjeipqRt\n4IieunRLMxWcuigzVLGJ01X1OhC2/8C/h8K29vwqf6OfvqWIFwGGKDViUlQ2\nUzxTxcxvlCvdW2L/3duuK6H6xZIYKnEHslCF4x3lSZiViQc2wsCnuFIgQSNG\nVsYr\r\n=ZPRH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB0DLCXEeJ5HjHe1dfMDpLG3BwnnOB1ZxlMILT5c5M/RAiB2kwzMRF6/LXMgb/zxvbw3mnTV/zcd6/2uoax3SMyvAQ=="}]},"_npmUser":{"name":"abutkeev","email":"abutkeev@abutkeev.ru"},"directories":{},"maintainers":[{"name":"abutkeev","email":"abutkeev@abutkeev.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ssi_0.3.1_1642059679508_0.1269831068909928"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-13T07:41:19.459Z","0.3.1":"2022-01-13T07:41:19.668Z","modified":"2022-04-04T11:04:04.737Z"},"maintainers":[{"name":"abutkeev","email":"abutkeev@abutkeev.ru"}],"description":"Server Side Includes for NodeJS","homepage":"https://github.com/kidwm/node-ssi#readme","keywords":["ssi","server side includes"],"repository":{"type":"git","url":"git+https://github.com/kidwm/node-ssi.git"},"author":{"name":"Chen-Heng Chang","email":"wandererm@gmail.com","url":"http://kidwm.net/"},"bugs":{"url":"https://github.com/kidwm/node-ssi/issues"},"license":"MIT","readme":"node-ssi\n========\n\n[![Build Status](https://travis-ci.org/kidwm/node-ssi.png)](https://travis-ci.org/kidwm/node-ssi)\n\nServer Side Includes for NodeJS\n\n__Note:__ The current version of ssi does all IO synchronously. Further development plans include writing methods asynchronously and migrating current methods to conform to Node conventions for synchronous methods.\n\n### Supported Instructions\n\n```html\n<!--#include virtual=\"\" -->\n<!--#include file=\"\" -->\n<!--#set var=\"\" value=\"\" -->\n<!--#echo var=\"\" -->\n\n<!--#if expr=\"\" -->\n<!--#elif expr=\"\" -->\n<!--#else -->\n<!--#endif -->\n```\n\n### Installation\n\n```bash\nnpm install ssi\n```\n\n### Usage\n\n```javascript\nvar ssi = require(\"ssi\");\n\nvar inputDirectory = \"/tmp/test\";\nvar outputDirectory = \"/tmp/output\";\nvar matcher = \"/**/*.shtml\";\n\nvar includes = new ssi(inputDirectory, outputDirectory, matcher);\nincludes.compile();\n```\n\nIf you want to support loosened spaces in directive like `<!-- #include file=\"\" -->` or `<!--  #include file=\"\"  -->`, just enable the fourth argument: `new ssi(inputDirectory, outputDirectory, matcher, true)`.\n\n#### BrowserSync Middleware\n\n```js\nmiddleware: [require('connect-modrewrite')([\n    '^(.*)\\.html$ $1.shtml'\n  ]), function(req, res, next) {\n    var fs = require('fs');\n    var ssi = require('ssi');\n    var baseDir = './';\n    var pathname = require('url').parse(req.url).pathname;\n    var filename = require('path').join(baseDir, pathname.substr(-1) === '/' ? pathname + 'index.shtml' : pathname);\n    var parser = new ssi(baseDir, baseDir, '/**/*.shtml');\n    if (filename.indexOf('.shtml') > -1 && fs.existsSync(filename))\n      res.end(parser.parse(filename, fs.readFileSync(filename, {\n        encoding: 'utf8'\n      })).contents);\n    else\n      next();\n  }]\n```\n\n### Methods\n\n#### parse(filename, contents)\n_filename_ `String` path to the file\n\n_contents_ `String` Contents of the file to be parsed\n\nMethod returns the parsed contents\n\n#### compile()\n\nMethod parses all of the files found by the matcher in the input directory, and writes the files to the output directory with identical names and directory structure.\n\n### License\n\nMIT\n","readmeFilename":"README.md"}