You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/uglify-examples.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,15 +39,15 @@ grunt.initConfig({
39
39
40
40
## Reserved identifiers
41
41
42
-
You can specify identifiers to leave untouched with an `except` array in the `mangle` options.
42
+
You can specify identifiers to leave untouched with an `reserved` array in the `mangle` options.
43
43
44
44
```js
45
45
// Project configuration.
46
46
grunt.initConfig({
47
47
uglify: {
48
48
options: {
49
49
mangle: {
50
-
except: ['jQuery', 'Backbone']
50
+
reserved: ['jQuery', 'Backbone']
51
51
}
52
52
},
53
53
my_target: {
@@ -85,7 +85,7 @@ grunt.initConfig({
85
85
86
86
## Advanced source maps
87
87
88
-
Set the `sourceMapIncludeSources` option to `true` to embed your sources directly into the map. To include
88
+
Set the `sourceMap.includeSources` option to `true` to embed your sources directly into the map. To include
89
89
a source map from a previous compilation pass it as the value of the `sourceMapIn` option.
90
90
91
91
```js
@@ -94,8 +94,9 @@ grunt.initConfig({
94
94
uglify: {
95
95
my_target: {
96
96
options: {
97
-
sourceMap:true,
98
-
sourceMapIncludeSources:true,
97
+
sourceMap: {
98
+
includeSources:true
99
+
},
99
100
sourceMapIn:'example/coffeescript-sourcemap.js', // input sourcemap from a previous compilation
100
101
},
101
102
files: {
@@ -106,7 +107,7 @@ grunt.initConfig({
106
107
});
107
108
```
108
109
109
-
Refer to the [UglifyJS SourceMap Documentation](http://lisperator.net/uglifyjs/codegen#source-map) for more information.
110
+
Refer to the [UglifyJS SourceMap Documentation](https://github.com/mishoo/UglifyJS2#source-map-options) for more information.
110
111
111
112
## Turn off console warnings
112
113
@@ -134,11 +135,9 @@ grunt.initConfig({
134
135
## Beautify
135
136
136
137
Specify `beautify: true` to beautify your code for debugging/troubleshooting purposes.
137
-
Pass an object to manually configure any other output options passed directly to `UglifyJS.OutputStream()`.
138
-
139
-
See [UglifyJS Codegen documentation](http://lisperator.net/uglifyjs/codegen) for more information.
138
+
Pass an object to manually configure any other output options.
140
139
141
-
_Note that manual configuration will require you to explicitly set `beautify: true` if you want traditional, beautified output._
140
+
See [UglifyJS documentation](https://github.com/mishoo/UglifyJS2#beautifier-options) for more information.
142
141
143
142
```js
144
143
// Project configuration.
@@ -155,8 +154,7 @@ grunt.initConfig({
155
154
my_advanced_target: {
156
155
options: {
157
156
beautify: {
158
-
width:80,
159
-
beautify:true
157
+
width:80
160
158
}
161
159
},
162
160
files: {
@@ -193,9 +191,9 @@ grunt.initConfig({
193
191
194
192
## Conditional compilation
195
193
196
-
You can also enable UglifyJS conditional compilation. This is commonly used to remove debug code blocks for production builds. This is equivalent to the command line [`--define` option](https://github.com/mishoo/UglifyJS#use-as-a-code-pre-processor).
194
+
You can also enable UglifyJS conditional compilation. This is commonly used to remove debug code blocks for production builds. This is equivalent to the command line `--define` option.
197
195
198
-
See [UglifyJS global definitions documentation](http://lisperator.net/uglifyjs/compress#global-defs) for more information.
196
+
See [UglifyJS global definitions documentation](https://github.com/mishoo/UglifyJS2#conditional-compilation) for more information.
199
197
200
198
```js
201
199
// Project configuration.
@@ -250,7 +248,7 @@ uglify: {
250
248
dev: {
251
249
options: {
252
250
mangle: {
253
-
except: ['jQuery']
251
+
reserved: ['jQuery']
254
252
}
255
253
},
256
254
files: [{
@@ -280,7 +278,9 @@ on the format of the exception file format please see the [UglifyJS docs](https:
0 commit comments