UNPKG

2.21 kBMarkdownView Raw
1
2ember-cli-uglify
3==============================================================================
4
5[![npm](https://img.shields.io/npm/v/ember-cli-uglify.svg)](https://www.npmjs.com/package/ember-cli-uglify)
6[![Build Status](https://travis-ci.org/ember-cli/ember-cli-uglify.svg?branch=master)](https://travis-ci.org/ember-cli/ember-cli-uglify)
7[![Build status](https://ci.appveyor.com/api/projects/status/xbx40pk5b4ykawjh/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/ember-cli-uglify/branch/master)
8
9[UglifyJS](https://github.com/mishoo/UglifyJS2) for [Ember.js](http://emberjs.com/).
10
11
12Installation
13------------------------------------------------------------------------------
14
15```
16ember install ember-cli-uglify
17```
18
19Usage
20------------------------------------------------------------------------------
21
22After installing `ember-cli-uglify` it will automatically hook into the build
23pipeline and minify your JS files in production builds.
24
25If you want to customize how `ember-cli-uglify` is running UglifyJS under the
26hood you have several configuration options available:
27
28```js
29// ember-cli-build.js
30
31var app = new EmberApp({
32 'ember-cli-uglify': {
33 enabled: true,
34
35 exclude: ['vendor.js'],
36
37 uglify: {
38 compress: {
39 sequences: 50,
40 },
41 output: {
42 semicolons: true,
43 },
44 },
45 },
46});
47```
48
49
50### Options
51
52- `enabled?: boolean`: Enables/Disables minification (defaults to `true` for
53 production builds, `false` for development builds)
54
55- `exclude?: string[]`: A list of paths or globs to exclude from minification
56
57- `uglify?: UglifyOptions`: A hash of [options](https://github.com/mishoo/UglifyJS2#minify-options)
58 that are passed directly to UglifyJS
59
60
61### Source Maps
62
63Source maps are disabled by default for production builds in Ember CLI. If you
64want to enable source maps for production builds you can configure that in your
65`ember-cli-build.js` too:
66
67```js
68// ember-cli-build.js
69
70var app = new EmberApp({
71 sourcemaps: {
72 enabled: true,
73 extensions: ['js'],
74 },
75});
76```
77
78
79License
80------------------------------------------------------------------------------
81ember-cli-uglify is licensed under the [MIT License](LICENSE.md).