Extension Details

- JsMin
- by Vine Code Limited
- 133 Recent Installs | 1820 Total Installs
- Automatically minify JS files on save.
- Repository
- Bug Reports
-
Read Files
-
Launch Subprocesses
-
This extension is allowed to:
Readme
JsMin Extension for Nova
Minify local JavaScript files automatically on save, or compile and beautify the current file using Nova’s Extensions menu.
Requirements and installation
Install Node.js, then install UglifyJS from Terminal:
npm install --global uglify-js
Install JsMin from Nova’s Extension Library and open a local project. Use Check UglifyJS Installation in the project settings to confirm the executable and version. Supported JavaScript syntax depends on your installed UglifyJS version.
Automatic compilation
By default, saving scripts/main.js generates scripts/main.min.js and its source map. The output is compact and compressed, comments are removed, and eligible names are shortened.
Only the saved file is processed—not every JavaScript file in the project. Files ending in .min.js or your chosen output suffix are skipped.
Manual compilation
Choose Extensions → JsMin → Compile Now to process the current local JavaScript file using your project settings. Output is written beside the source using the configured suffix.
This works even when Run on Save is No. Unsaved changes are saved before processing. Save a new, untitled file locally before using the command.
Beautify the current file
Choose Extensions → JsMin → Beautify Now to format the current local JavaScript file with readable indentation and line breaks.
This command updates the source file in place and preserves comments. It does not compress, wrap or mangle the code, and works even when Run on Save is No. Keep a backup or use version control before formatting.
Both manual commands are also available under Editor → JsMin. The menu commands are enabled when a JavaScript editor is active.
Project settings
Open Project → Project Settings → Languages & Extensions → JsMin.
Each project can have its own settings. The controls show saved project choices or the defaults below. Your first change saves the complete set of displayed project choices. Opening a project or viewing settings does not save preferences.
General
- Run on Save: Process local JavaScript files after saving. Default: Yes.
- Generate Source Map: Write a
.mapfile beside the output to help browser debugging refer back to the original source. Default: Yes.
Output
- Output Format: Compact removes unnecessary spaces and line breaks; Beautified adds readable formatting. Default: Compact. Compression and mangling are controlled separately under Advanced.
- Output Suffix: Replace the source’s
.jsextension with this suffix. Default:.min.js. - Keep Comments: Preserve comments in compiled output. Default: No. When enabled, Advanced → Comments to Keep selects which comments to retain.
For example, an output suffix of .compiled.js turns scripts/main.js into scripts/main.compiled.js, with main.compiled.js.map when source maps are enabled.
An empty suffix uses .min.js. Choose a distinct suffix ending in .js, not .js alone or a folder path. Changing the suffix does not delete older output files. Beautify Now always updates the source instead.
Advanced
- Compression: Optimise the code by simplifying expressions and removing unnecessary code. Default: Yes. Compression can be used with either Compact or Beautified output.
- Mangle Names: Shorten eligible variable and parameter names. Default: Yes. Top-level names are not mangled.
- Preserve Function Names: Protect function names during compression and mangling. Useful for code relying on
Function.nameor clearer stack traces. Default: No. Choosing No allows optimisation; it does not force names to change. - Indent Size: A whole number from 0 to 16 spaces for beautified output, including Beautify Now. Default: 4.
- Comments to Keep: All or License (
@license,@preserve, or comments starting with!). Only applies when Keep Comments is Yes. Default: All. Compression may still discard comments attached to removed code. - Wrap Module: An optional module name, such as
MyLibrary. Wraps the code withexportsandglobalavailable inside it. This does not bundle dependencies. Default: empty. - Mangle Properties: Rename object properties. Default: No. Use with caution: this can break public APIs, JSON keys and properties shared across separately compiled files. Do not assume property names will stay consistent between files.
- Property Name Pattern: An optional regular expression body, without
/delimiters, to restrict property mangling. For example,^_targets names starting with an underscore. Empty targets all eligible properties. - Reserved Properties: Comma-separated property names to exclude from property mangling.
- Keep Quoted Properties: Exclude quoted property names from property mangling. Default: Yes.
These options apply to automatic compilation and Compile Now. Beautify Now uses only Indent Size and always preserves comments.
UglifyJS installation
UglifyJS Executable lists detected installations and their versions. The selection shows your saved project choice or an automatically detected installation, not your old global preference. Until you change a project setting, compilation still honours an existing global executable preference. Choose a listed executable or enter a custom path to use a specific installation for this project.
JsMin checks Nova’s PATH, /opt/homebrew/bin/uglifyjs, and /usr/local/bin/uglifyjs. Paths containing spaces are supported.
Check UglifyJS Installation displays the installation status, version and executable path. If the executable cannot be found or does not respond, install UglifyJS or correct the selection.
Errors and warnings
Syntax errors appear in Nova’s Issues sidebar and highlight the reported location in the editor. Fix the error and compile that file again to clear it. UglifyJS usually reports the first syntax error it encounters.
Compilation failures also display a notification. The Extension Console contains full error details and output paths. Problems such as a missing executable or insufficient permissions are reported there and in a notification, without a source-line highlight.
Non-fatal warnings are logged in the console and do not prevent successful compilation.
Remote files
JsMin supports local files only. Attempting to process a remote JavaScript file displays a warning.
For remote websites, keep a local project, compile locally, and use Nova Publishing to upload the generated JavaScript and optional source maps.
Upgrading
From 1.0 or 1.1 to 1.1.1
Version 1.1.1 fixes a missing read permission used to recognise saved project preferences. It resolves the “does not declare a read entitlement for the file system” warning. No settings changes are required, and compilation options and defaults remain unchanged.
Version 1.1 simplifies the Editor menu labels and makes the Extensions commands available only when a JavaScript editor is active. Compilation behaviour, saved settings and defaults are unchanged. No settings changes are needed.
From versions before 1.0
Settings are now per project. There are no global settings to view or edit in this version.
Please note!
After upgrading, projects without saved JsMin settings continue using your previous global preferences, so compilation behaves as before. However, the project radio buttons show this version's defaults, not those old global values.
Changing any JsMin project setting saves the complete set of project choices: the values you select, any already saved project choices, and our defaults for everything else. Old global preferences are not copied across. From then on, only project settings are used, including after reopening the project. Simply opening settings does not trigger this switch.
Review all the options before making your first change, particularly Run on Save, Mangle Names and Generate Source Map. If you previously used a custom UglifyJS path, select it explicitly when switching to project settings; otherwise automatic detection is used.
The previous compilation defaults are retained: run on save, compression, name mangling and source maps enabled; compact output, comments removed, and .min.js output. Function-name preservation, property mangling and wrapping are off by default.
Your installed UglifyJS version and chosen settings can affect the generated output.
Troubleshooting
- Executable not found: Use Check UglifyJS Installation, select the correct executable, and confirm Node.js is installed. Nova’s PATH may differ from Terminal’s.
- No output on save: Check Run on Save and ensure the file is local, ends in
.js, and does not already end in the output suffix or.min.js. Try Compile Now and check the Extension Console. - Unexpected renamed variables: Set Mangle Names to No. Compression remains independent.
- Code relies on function names: Enable Preserve Function Names.
- Old output remains after changing the suffix: Remove obsolete generated files after checking that your site no longer references them.
Release Notes
ChangeLog
Version 1.1.1
- Fix the missing filesystem read permission that prevented JsMin from recognising saved project preferences during upgrade handling.
- Remove the associated permission warning from the Extension Console. Compilation options and defaults are unchanged.
Version 1.1
- Simplify Editor → JsMin command labels to Compile Now and Beautify Now, removing the redundant JsMin prefix.
- Disable the Extensions → JsMin compilation and beautification commands when no JavaScript editor is active, matching the Editor menu.
- Compilation behaviour, settings and defaults are unchanged from 1.0.
Version 1.0
- Configure each project independently, with simple radio-button choices. Existing global preferences continue to apply until project settings are customised; the first change saves the selected project values and defaults without copying old globals. Previous compilation defaults are retained.
- Organise settings into General, Output, Advanced, and UglifyJS Installation.
- Add Compact/Beautified output, configurable output suffix (default
.min.js), comment preservation, compression and function-name controls. - Add a numeric Indent Size setting for beautified output, accepting 0–16 spaces with a default of 4.
- Add optional wrapping and property mangling with pattern and reserved-name controls. These remain disabled by default.
- Add Compile Now and Beautify Now under Extensions → JsMin and as JsMin-labelled commands in the editor menu. Both target the current local file and work with Run on Save disabled. Beautify Now formats the source in place and preserves comments without compression or mangling.
- Detect UglifyJS installations and show executable/version choices with an installation status check.
- Report syntax errors in Issues and at their editor locations; log full diagnostics and processing results in the Extension Console.
- Clearly warn about unsupported remote files without launching the compiler.
- Improve compilation reliability by processing the latest saved contents and preventing overlapping operations on the same file.
- Correct output paths when parent directories contain
.js; support executable paths containing spaces. - Improve error handling so non-fatal warnings are not treated as compilation failures.
- Replace the icon with a shaded yellow button, black lettering and transparent background.
Version 0.7.1
- Bug fix for exec path
Version 0.7
- Icon Updates and internal restructure
Version 0.6
- Updated README
Version 0.5
- Auto hide the error notification after 10 seconds or if the file is re-saved without an error.
- Other bug fixes
Version 0.4
- Fix autosave preference
Version 0.2
- Basic functional release
License
MIT License
Copyright (c) 2020 Vine Code Limited
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.