@webmangler/core
v0.1.28
Published
The WebMangler core
Downloads
1
Readme
WebMangler Core
The WebMangler Core is the central package of the WebMangler ecosystem. It can be used by itself programmatically or through other packages and plugins.
Usage
Install the webmangler
core, e.g.:
npm install webmangler --save-dev
And use it programmatically, e.g.:
import webmangler from "@webmangler/core";
import { BuiltInLanguagesSupport } from "webmangler/languages";
import { RecommendedManglers } from "webmangler/manglers";
// Read in the files you want to mangle ...
const originalFiles = [
{ type: "css", content: "..." },
{ type: "html", content: "..." },
{ type: "js", content: "..." },
];
// and run WebMangler.
const { files } = webmangler(originalFiles, {
plugins: [new RecommendedManglers()],
languages: [new BuiltInLanguagesSupport()],
});
console.log(files[0]);
// Outputs: { type: "css", content: "..." }
Which will mangle CSS classes, CSS variables, and HTML data attributes in CSS, HTML, and JavaScript.
Other ways to use WebMangler
- as a CLI - WebMangler CLI