Skip to content

Commit

Permalink
Update uglify-examples.md (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
omidraha authored and XhmikosR committed Feb 10, 2017
1 parent 90db406 commit d85adc7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/uglify-examples.md
Expand Up @@ -238,6 +238,37 @@ grunt.initConfig({
});
```

## Compiling all files separately on the each their path

This configuration will compress and mangle all js files separately in each folder.

Also exclude jQuery for mangling and ignore all `*.min.js` files.

```js
// Project configuration.
uglify: {
dev: {
options: {
mangle: {
except: ['jQuery']
}
},
files: [{
expand: true,
src: ['dist/assets/js/*.js', '!dist/assets/js/*.min.js'],
dest: 'dist/assets',
cwd: '.',
rename: function (dst, src) {
// To keep the source js files and make new files as `*.min.js`:
// return dst + '/' + src.replace('.js', '.min.js');
// Or to override to src:
return src;
}
}]
}
},
```

## Turn on object property name mangling

This configuration will turn on object property name mangling, but not mangle built-in browser object properties.
Expand Down

0 comments on commit d85adc7

Please sign in to comment.