
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
inlining linked CSS files, linked script files, and SVG images into HTML documents
inlining linked CSS files, linked script files, and SVG images into HTML documents
The HTinliner can be used with Gulp or as an independent function. It supports the following options:
inlineStylesheets<link rel="stylesheet" href="..."> tags should be replaced by a <style> tag with the referenced file content.inlineScripts<script src="..."></script> tags should be
filled with the content of the referenced file.inlineSvgImages<img src="...somthing.svg"> tags should be
replaced by the SVG markup from the referenced image file.basePathsvgRemoveSizesvgLimitSizemax-width and max-height.svgWrapsvgWrapElement,
and the CSS class specified in the option svgWrapClass.svgWrapElementsvgWrapClassThe default options are:
{
inlineStylesheets: true,
inlineScripts: true,
inlineSvgImages: true,
basePath; null,
svgRemoveSize: false,
svgLimitSize: false,
svgWrap: true,
svgWrapElement: 'span',
svgWrapClass: 'htinliner',
throwOnNotFound: false
}
The inlining only takes place if the URL, referencing the stylesheet, script, or SVG image, is a relative URL.
If a script tag already has some content, than an aditional script tag
with the referenced script is inserted before the referencing tag
and the src attribute is removed from the referencing tag.
HTinliner provides its API with GulpText simple.
To use HTinliner in Gulp, it can be called with no or one argument:
htinliner([options])
where the optional argument represents the option object.
var gulp = require('gulp');
var htinliner = require('htinliner');
gulp.task('default', function() {
gulp.src('*.html', { cwd: 'src' })
.pipe(htinliner({ inlineScripts: false }))
.pipe(gulp.dest('standalone'));
});
To use HTinliner as a function, it can be called with one or two arguments.
htinliner(html, [options])
html accepts a string with the HTML markup,options accepts a map with the attribute sourceFile,
which is the reference for the relative URLs in the HTML markup.var fs = require('fs');
var htinliner = require('htinliner');
var filename = 'src/example.html';
fs.readFile(filename, function(err, data) {
if (err) { throw err; }
var result = htinliner(data, { sourcePath: filename });
fs.writeFile('standalone.html', result, function(err, data) {
if (err) { throw err; }
});
}, 'utf-8');
To use HTinliner to transform an HTML file directly, use the function .readFileSync(path, [options).
var htinliner = require('htinline');
var filename = 'src/example.html';
var result = htinliner.readFileSync(filename);
HTinliner is published under the MIT license.
FAQs
inlining linked CSS files, linked script files, and SVG images into HTML documents
We found that htinliner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.