{"id":29724586,"url":"https://github.com/mastersign/htinliner","last_synced_at":"2025-07-24T21:22:27.417Z","repository":{"id":19887111,"uuid":"23151606","full_name":"mastersign/htinliner","owner":"mastersign","description":"Inlines linked CSS files, linked script files, and SVG images into HTML documents.","archived":false,"fork":false,"pushed_at":"2024-06-27T16:31:30.000Z","size":79,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-09T17:38:07.600Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastersign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-20T14:26:47.000Z","updated_at":"2022-12-05T06:55:37.000Z","dependencies_parsed_at":"2023-01-13T20:39:15.090Z","dependency_job_id":null,"html_url":"https://github.com/mastersign/htinliner","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/mastersign/htinliner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fhtinliner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fhtinliner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fhtinliner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fhtinliner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastersign","download_url":"https://codeload.github.com/mastersign/htinliner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fhtinliner/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266904631,"owners_count":24004135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-24T21:22:21.822Z","updated_at":"2025-07-24T21:22:27.109Z","avatar_url":"https://github.com/mastersign.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTinliner\n\n[![npm package][npm-img]][npm-url]\n[![dependency status][libraries-img]][libraries-url]\n[![build status][travis-img]][travis-url]\n\n\u003e inlining linked CSS files, linked script files, and SVG images into HTML documents\n\n## Usage\n\nThe _HTinliner_ can be used with [Gulp] or as an independent function.\nIt supports the following options:\n\n* `inlineStylesheets`  \n  a boolean indicating, that `\u003clink rel=\"stylesheet\" href=\"...\"\u003e` tags should be replaced by a `\u003cstyle\u003e` tag with the referenced file content.\n* `inlineScripts`  \n  a boolean indicating, that `\u003cscript src=\"...\"\u003e\u003c/script\u003e` tags should be\n  filled with the content of the referenced file.\n* `inlineSvgImages`  \n  a boolean indicating, that `\u003cimg src=\"...somthing.svg\"\u003e` tags should be\n  replaced by the SVG markup from the referenced image file.\n* `basePath`  \n  a file or folder name, which is used as base path for resolving the relative paths of the inlined files.\n* `svgRemoveSize`  \n  a boolean indicating, that the specified width and height should be removed\n  from the SVG markup.\n* `svgLimitSize`  \n  a boolean indicating, that the specified size, or if none given, the SVG element size,\n  is copied to the CSS properties `max-width` and `max-height`.\n* `svgWrap`  \n  a boolean indicating, that the SVG markup should be wrapped in an additional\n  HTML element, which is specified in the option `svgWrapElement`,\n  and the CSS class specified in the option `svgWrapClass`.\n* `svgWrapElement`  \n  a string with the name of the HTML element, wrapping the inlined SVG markup.\n* `svgWrapClass`  \n  a string with the CSS class of the HTML element, wrapping the inlined SVG markup.\n\nThe default options are:\n\n```js\n{\n    inlineStylesheets: true,\n    inlineScripts: true,\n    inlineSvgImages: true,\n    basePath; null,\n    svgRemoveSize: false,\n    svgLimitSize: false,\n    svgWrap: true,\n    svgWrapElement: 'span',\n    svgWrapClass: 'htinliner',\n    throwOnNotFound: false\n}\n```\n\nThe inlining only takes place if the URL, referencing the stylesheet, script, or SVG image, is a relative URL.\n\nIf a `script` tag already has some content, than an aditional `script` tag\nwith the referenced script is inserted before the referencing tag\nand the `src` attribute is removed from the referencing tag.\n\n## Interface\n\n_HTinliner_ provides its API with [GulpText _simple_][gulp-text-simple].\n\n### Usage with Gulp\n\nTo use _HTinliner_ in [Gulp], it can be called with no or one argument:\n\n`htinliner([options])`\n\nwhere the optional argument represents the option object.\n\n```js\nvar gulp = require('gulp');\nvar htinliner = require('htinliner');\n\ngulp.task('default', function() {\n    gulp.src('*.html', { cwd: 'src' })\n        .pipe(htinliner({ inlineScripts: false }))\n        .pipe(gulp.dest('standalone'));\n});\n```\n\n### Usage as a function\n\nTo use _HTinliner_ as a function, it can be called with one or two arguments.\n\n`htinliner(html, [options])`\n\n* where the first argument `html` accepts a string with the HTML markup,\n* the second argument `options` accepts a map with the attribute `sourceFile`,\nwhich is the reference for the relative URLs in the HTML markup.\n\n```js\nvar fs = require('fs');\nvar htinliner = require('htinliner');\n\nvar filename = 'src/example.html';\nfs.readFile(filename, function(err, data) {\n    if (err) { throw err; }\n\n    var result = htinliner(data, { sourcePath: filename });\n\n    fs.writeFile('standalone.html', result, function(err, data) {\n        if (err) { throw err; }\n    });\n}, 'utf-8');\n```\n\n### Transform a file directly\n\nTo use _HTinliner_ to transform an HTML file directly, use the function `.readFileSync(path, [options)`.\n\n``` js\nvar htinliner = require('htinline');\n\nvar filename = 'src/example.html';\nvar result = htinliner.readFileSync(filename);\n```\n\n## License\n\n_HTinliner_ is published under the MIT license.\n\n[npm-url]: https://www.npmjs.com/package/htinliner\n[npm-img]: https://img.shields.io/npm/v/htinliner.svg\n[libraries-url]: https://libraries.io/npm/htinliner\n[libraries-img]: https://img.shields.io/librariesio/github/mastersign/htinliner.svg\n[travis-img]: https://img.shields.io/travis/mastersign/htinliner/master.svg\n[travis-url]: https://travis-ci.org/mastersign/htinliner\n[Gulp]: http://gulpjs.com\n[gulp-text-simple]: https://www.npmjs.com/package/gulp-text-simple\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fhtinliner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastersign%2Fhtinliner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fhtinliner/lists"}