Compiler — Examples
Hands-on runs with the Compiler: compile SCSS with Dart Sass, use Sass modules and @debug, minify JavaScript and HTML, make someone else's CSS readable.
Back to the overview: Compiler · Open the tool: www.jpkc.com/tools/compiler/
The manual explains every tab and option in detail. This page adds concrete workflows — typical tasks, walked through step by step. Tab and button names appear exactly as the tool labels them.
Example 1: Compile SCSS to CSS
The classic — you have an SCSS snippet and want to see the CSS it produces.
- Open the Compiler; the
SASS/SCSStab is already active and pre-filled with a sample (@use "sass:color"and"sass:math", variables, a mixin, nesting). - Replace the sample with your own SCSS, or use Upload file to load a
.scssor.sassfile. - Leave Syntax on
Auto-detectand the Output Style onExpanded(readable CSS), then click Compile. - The first time, "Loading Sass compiler..." appears briefly — the Dart Sass module, roughly 0.9 MB gzip-compressed, is loaded once. After that the finished CSS sits in the output editor on the right.
- Grab it with Copy to the clipboard, or Download it — as
styles.cssor, if you uploaded a file, under that file's name (theme.scssbecomestheme.css).
If your SCSS has a syntax error, the tool doesn't blindly carry on: it writes the error message with line and column as a comment into the output, flags the line in the input editor, and puts the cursor right there — you see immediately where it breaks.
Example 2: Production-ready, minified CSS in one step
You want compressed CSS straight from SCSS, without a separate minify step afterwards.
- Stay in the
SASS/SCSStab and paste your SCSS. - Set the Output Style to
Compressed. - Compile — the output is now minified CSS on a single line, with no superfluous whitespace.
This saves the detour through the CSS minify tab and is the clean route when your stylesheet originates from SCSS anyway: the engine produces the compressed form itself, rather than squeezing it out of finished CSS afterwards. Note that Download names the file styles.css here (or after your upload), without .min — the tool only appends that after a Minify in the other tabs. If you need a .min.css name, rename the file after saving it.
Example 3: Minify JavaScript
A helper function or a small script needs to be shrunk for production.
- Switch to the
JavaScripttab and paste your code (or load a.jsor.mjsfile via Upload file). - Check the minify options: Mangle names (default: on) shortens local names; Drop console (default: off) removes
console.*calls. For production code it often pays to tick Drop console as well — the tool remembers the setting for your next visit. - Click Minify. The shrinking is done by Terser (opens in a new tab); the result appears on the right.
- If your code has a syntax error, the Terser error message shows up in the output as
// Error: …— fix the spot and minify again. - Download saves the result as
script.min.js— or, after uploadingapp.js, asapp.min.js.
If you instead need readable code (say, an indented version of a compact file), use Beautify rather than Minify in the same tab.
Example 4: Make someone else's squashed CSS readable
You've received minified CSS — all on one line — and want to understand it.
- Go to the
CSStab and paste the compact CSS into the input editor. - Pick your preferred Indent Size (
2 spacesor4 spaces). - Click Beautify. The CSS appears on the right, cleanly indented with line breaks and one declaration per line — via JS Beautifier (opens in a new tab).
The same workflow applies in the HTML and JavaScript tabs. If your only goal is readability and the JavaScript comes in packed form (P.A.C.K.E.R. or URL-encoded), the dedicated Beautify tool is the better choice — it unpacks such code before formatting. Code obfuscated in other ways, such as with renamed variables, isn't untangled by either tool.
Example 5: Minify HTML for delivery
An HTML fragment should become more compact for production.
- Switch to the
HTMLtab and paste your markup. - If you also want to lose the comments, tick Remove comments (this option only applies to Minify).
- Click Minify. Every run of spaces and line breaks shrinks to a single space, and embedded
<style>blocks are minified along with it; the result sits on the right, and the success message reports the savings in KB and percent. - The tool copies the contents of
<pre>,<textarea>, and<script>unchanged, and conditional comments (<!--[if …]>) survive even with Remove comments — the page looks the same afterwards as before. - Download saves this version as
index.min.html, or under your uploaded file's name plus.min.
Example 6: From compact to indented HTML and back
You juggle between readable editing and compact delivery.
- In the
HTMLtab, paste compact markup and click Beautify — choose Indent Size and Wrap Length (e.g.120) first. The result is cleanly indented and easy to read. - Click Use output as input on the output card: the indented version now sits on the left in the input editor, and you edit it right there. Not happy with it? Ctrl+Z in the input editor restores the previous state in one step.
- For delivery, click Minify — there's your compact version, ready to take away via Copy or Download.
That's how you use both directions of the same tab as a pair: beautify to work, minify to ship. The same three steps work in the CSS and JavaScript tabs.
Example 7: Use modern Sass modules and @debug
You want to try code that uses the Sass module system and check intermediate values along the way.
-
In the
SASS/SCSStab, paste a snippet like this one:scss @use "sass:math"; @use "sass:color"; $base: 16px; $brand: #0d6efd; @debug math.div($base, 2); .card { padding: math.div($base, 2); border-color: color.adjust($brand, $lightness: -10%); } -
Click Compile. The CSS appears on the right; the
@debugoutput does not end up in it but in the yellow box below the editors ("1 message from Sass:", with the line number), and the line is flagged in the input editor's gutter. -
If Dart Sass reports warnings about outdated code along the way (prefix
Deprecation:), they show up in the same list — so you can see which spots are worth modernizing.
You can't load files from your project via @use, though; if you need partials, paste them into the input editor as well.
Going deeper: the overview for the big picture, the manual for every engine and option in detail, and the tips & tricks for strategy and pitfalls. You can try all of it directly in the tool.