The CSS & JS Minifier extension for Visual Studio Code allows you to minify CSS and JavaScript files directly from the editor. Using the minification service provided by Toptal, this extension makes it quick and easy to optimize your files.
Minify File through context menu
Minify and Save as New File through context menu
- CSS and JavaScript Minification: Minify open CSS and JS files in the editor using commands from the command palette or the context menu.
- Minify to New File: Save the minified file to a new file with the
.min
suffix (e.g.,file.min.css
orfile.min.js
). - Automatic Minification on Save: Configure the extension to automatically minify CSS and JS files when saving them.
- Intuitive Commands: Easily access minification features through the command palette and the editor's context menu.
Minify
: Minifies the current CSS or JS file and overwrites its content.Minify and Save as New File
: Minifies the current CSS or JS file and saves the result to a new file with the.min
suffix.
You can customize the extension's behavior through the available settings in VS Code:
css-js-minifier.minifyOnSave
: Automatically minify CSS and JS files when saving them. (true
orfalse
, default isfalse
).css-js-minifier.minifyInNewFile
: Save the minified content to a new file instead of overwriting the original. (true
orfalse
, default isfalse
).css-js-minifier.minifiedNewFilePrefix
: Specify a custom prefix for the new minified file. (default is.min
).
To adjust these settings, add the following lines to your settings.json
file:
{
"css-js-minifier.minifyOnSave": true,
"css-js-minifier.minifyInNewFile": true,
"css-js-minifier.minifiedNewFilePrefix": ".min"
}
The extension provides convenient keyboard shortcuts for quick access to its commands:
Minify
:alt+ctrl+m
(Windows/Linux)option+ctrl+m
(Mac)
Minify and Save as New File
:alt+ctrl+n
(Windows/Linux)option+ctrl+n
(Mac)
- Open VS Code.
- Go to the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X
(Windows/Linux) orCmd+Shift+X
(Mac) - Search for "
CSS & JS Minifier
". - Click Install.
- Open a CSS or JS file in VS Code.
- Use the command palette (
Ctrl+Shift+P
orCmd+Shift+P
on Mac) and type Minify to access the minification commands. - Alternatively, right-click within the editor and select the desired minification option from the context menu.
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
This extension is licensed under the MIT License.
All notable changes to the "css-js-minifier" extension will be documented in this file. Change Log