JS CSS Minifier

by Andrew Bagshaw for brackets >=0.24.0 
Easily minify single files or all files in a project. Also includes concatenation features as well as auto-minification on save.
version
3.0.0
modified
2017-12-08T00:46:01.574Z
first seen
2015-07-17T05:40:38.603Z
downloads
116206
 Versions
3.0.0
2017-12-08T00:46:01.574Z
28279
2.0.0
2017-04-16T21:40:51.052Z
24011
1.1.7
2016-11-29T16:22:40.032Z
17753
1.1.6
2016-02-15T21:50:14.720Z
24684
1.1.5
2015-11-15T06:10:52.352Z
9802
1.1.4
2015-08-06T00:09:26.815Z
7414
1.1.3
2015-07-28T04:00:08.433Z
1544
1.1.2
2015-07-27T00:22:17.675Z
507
1.1.1
2015-07-26T20:07:15.400Z
161
1.1.0
2015-07-26T19:20:37.541Z
189
1.0.4
2015-07-25T03:02:41.870Z
443
1.0.3
2015-07-17T18:06:04.352Z
974
1.0.2
2015-07-17T16:34:54.924Z
119
1.0.1
2015-07-17T16:04:54.342Z
114
1.0.0
2015-07-17T05:40:38.603Z
212
 Readme
# Minifier for [Brackets](https://github.com/adobe/brackets) *Minifies JavaScript and CSS files in Brackets and saves to `{filename}.min.{ext}` using [UglifyJS3](https://github.com/mishoo/UglifyJS2) (for JavaScript) and [CleanCSS](https://github.com/jakubpawlowicz/clean-css) (for CSS).* ## Installation 1. Run Brackets 2. Select *File > Install Extension...* 3. Enter `https://github.com/abagshaw/brackets-minifier/archive/master.zip` as Extension URL. 3. Click Install to begin downloading and installing the extension. #### Alternative Installation Method Clone this repository into `~/Library/Application Support/Brackets/extensions/user/` and restart Brackets. ## Features - [Single File Minification](#single-file-minification) - [Project Minification](#project-minification) - [Custom Save Directories](#custom-save-directories) - [Minifier Options](#minifier-options) --- ### Single File Minification To minify a file, use the keyboard shortcut `Cmd/Ctrl+Alt+M` (this will also save the file if there are unsaved changes). You can also minify files on save by checking *Minify on Save* in the *Edit* menu. --- ### Project Minification To minify all JS and CSS files in the current project (and subdirectories), use the keyboard shortcut `Cmd/Ctrl+Alt+A`. You can also set the whole project to be minified on save by going to *Edit -> Minifier Preferences* and selecting *Minify Project on Save*. This will minify all the JS and CSS files in the current project when saving *any file* located in the current project - not necessarily a JS or CSS file. If any file about to be minified has unsaved changes, it will be saved first. **NOTE:** To minify the whole project on save you must *also* check the *Minify on Save* option in the *Edit* menu. **NOTE:** Files open in the *Working Files* area that are not located within the current project directory are not considered part of the current project and will not be included in project minification, affected by project minification settings or trigger project minification on save. These files can still be minified using [single file minification](#single-file-minification) #### Excluding Files/Directories/Filetypes You can exclude certain directories and files by entering each directory/file on a new line in the *Directories/Files to Exclude from Project Minification* area. Excluded directories **must** include trailing slash! Excluded JS/CSS files or JS/CSS files in excluded directories will not be minified during project minification and will also be ignored during [concatenation](#concatenation). You can also exclude all JS or CSS files from being minified by unchecking either of the *Minify JavaScript during Project Minification* or *Minify CSS during Project Minification* options in the *Minifier Preferences* panel. **NOTE:** [Concatenated](#concatenation) files are always minified whether or not their specific filetype is disabled for minification as described above. **NOTE:** Excluded files or files of an excluded directory/filetype can still be minified using [single file minification](#single-file-minification). --- ### Custom Save Directories To specify custom paths to save minified files to, go to *Edit -> Minifier Preferences* and enter the desired paths for minified CSS and JS files in the spaces provided. These paths begin at the project root directory. Leaving a path blank will set the minified files of that type to be saved in the same directory as the original non-minified file. **NOTE:** Custom save directories will apply to [single file minification](#single-file-minification) (on files within the current project), [project minification](#project-minification) and concatenated files generated with the [concatenation](#concatenation) feature. --- ### Concatenation To enable concatenation, go to *Edit -> Minifier Preferences* and enter the desired name for your concatenated CSS and/or JS file(s) in the spaces provided in the concatenation section. A blank field will disable concatenation for that type of file (i.e. leaving the name for concatenated CSS file field blank will disable CSS concatenation). Only enter the name of the file without the extension. For example, entering (`alljs` in the JS concatenated file name field will result in a `alljs.js` file and `alljs.min.js` file being created for the raw concatenated file and minified concatenated file respectively). Concatenated files will be saved in the root of the project directory or in the [custom save directory](#custom-save-directory) if one is specified for that specific file type (CSS or JS). **NOTE:** Concatenation only runs during [project minification](#project-minification) and only applies to files within the current project. **NOTE:** Concatenation will *ignore* files with the same name as the desired name for the output concatenation file and will also ignore files ending in `.min.js` or `.min.css` for JS and CSS concatenation respectively. --- ### Minifier Options You can choose to pass your own set of [UglifyJS3 options](https://github.com/mishoo/UglifyJS2#minify-options) and/or [CleanCSS options](https://github.com/jakubpawlowicz/clean-css#constructor-options) by navigating to *Edit -> Minifier Preferences* and scrolling down to the very bottom. **NOTE:** Options must be passed as a valid JSON object. For example, to disable mangling and compression during JS minification you would enter the following in the **UglifyJS3 Options** area: ``` { "mangle": false, "compress": false } ```