Two optimization modes
Use BASIC for standard minification or ADVANCED for modern optimization engines.
Developer utilities · REST API
Reduce CSS and JavaScript payload size using dedicated REST endpoints, with standard or advanced optimization modes.
Free tier available. Both endpoints require a JWT Bearer Token.
Use BASIC for standard minification or ADVANCED for modern optimization engines.
Send source code as text/plain and receive minified code as text/plain.
Inspect response headers for the engine, processing time, input/output sizes and compression ratio.
Remove unnecessary whitespace and comments while preserving valid JavaScript semantics. BASIC uses Google Closure Compiler; ADVANCED uses esbuild. Maximum input size: 1 MiB. The endpoint also performs security analysis for potentially unsafe constructs.
Endpoint
POST
/api/v1/tools/minify-js?mode=BASIC
Content-Type: text/plain
·
Accept: text/plain
The mode query parameter is optional and defaults to BASIC. Supply ADVANCED to select the alternative engine.
Request (text/plain)
function hello() {
console.log('Hello DevHub');
}
Response (text/plain)
function hello(){console.log('Hello DevHub');}
Reduce CSS by removing unnecessary whitespace, comments and redundant semicolons. BASIC uses YUI Compressor; ADVANCED uses Lightning CSS. Maximum input size: 10 MiB.
Endpoint
POST
/api/v1/tools/minify-css?mode=BASIC
Content-Type: text/plain
·
Accept: text/plain
The mode query parameter is optional and defaults to BASIC. Supply ADVANCED to select the alternative engine.
Request (text/plain)
.a {
color : red}
.b {
margin : 0}
Response (text/plain)
.a{color:red}.b{margin:0}
| API | BASIC | ADVANCED | Maximum input |
|---|---|---|---|
| JavaScript | Google Closure Compiler | esbuild | 1 MiB |
| CSS | YUI Compressor | Lightning CSS | 10 MiB |
Both endpoints return the minified content in the response body and expose processing information in HTTP headers.
| Header | Meaning |
|---|---|
DevHub-Minifier |
Minification engine used |
DevHub-Processing-Time-Ms |
Processing time |
DevHub-Optimization-Mode |
Optimization mode used |
DevHub-Original-Size-Bytes |
Original payload size in bytes |
DevHub-Minified-Size-Bytes |
Minified payload size in bytes |
DevHub-Engine-Version |
Engine version |
DevHub-Compression-Ratio |
Compression ratio |