Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit ff5e0f2

Browse files
committed
docs(readme): Add readme file
1 parent 4239422 commit ff5e0f2

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Serverless Optimizer Plugin
2+
=============================
3+
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)
4+
5+
Bundle with Browserify, transpile with Babel to ES5 and minify with Uglify your Serverless functions.
6+
7+
This plugin is a child of the great [serverless-optimizer-plugin](https://github.com/serverless/serverless-optimizer-plugin). Kudos!
8+
9+
**Note:** Requires Serverless *v1.0.0* or higher.
10+
11+
## Setup
12+
13+
Install via npm in the root of your Serverless service:
14+
```
15+
npm install serverless-plugin-optimize babel-preset-es2015 --save-dev
16+
```
17+
18+
* Add the plugin to the `plugins` array in your Serverless `serverless.yml`, like this:
19+
20+
```yml
21+
plugins:
22+
- serverless-plugin-optimize
23+
```
24+
25+
* All done!
26+
27+
## Options
28+
29+
Configuration options can be set globally in `custom` property and inside function in `optimize` property.
30+
31+
#### Global
32+
33+
* **debug** (default `false`) - When debug is set to `true` it won't remove `prefix` folder and will generate debug output at the end of package creation.
34+
35+
```yml
36+
custom:
37+
optimize:
38+
debug: true
39+
```
40+
41+
* **exclude** (default `aws-sdk`) - Array of modules that will be globally excluded from all the bundles.
42+
43+
```yml
44+
custom:
45+
optimize:
46+
exclude: ['ajv']
47+
```
48+
49+
* **minify** (default `true`) - When mininify is set to `false` your functions won't be minified.
50+
51+
```yml
52+
custom:
53+
optimize:
54+
minify: false
55+
```
56+
57+
* **presets** (default `es2015`) - Array of Babel presets.
58+
59+
```yml
60+
custom:
61+
optimize:
62+
presets: ['es2016']
63+
```
64+
65+
#### Function
66+
67+
* **optimize** (default `true`) - When optimize is set to `false` the specific function won't be optimized.
68+
69+
```yml
70+
functions:
71+
hello:
72+
optimize: false
73+
```
74+
75+
* **exclude** - Array of modules that will be excluded from the specific function.
76+
77+
```yml
78+
functions:
79+
hello:
80+
optimize:
81+
exclude: ['ajv']
82+
```
83+
84+
## Contribute
85+
86+
Help us making this plugin better and future proof.
87+
88+
* Clone the code
89+
* Install the dependencies with `npm install`
90+
* Create a feature branch `git checkout -b new_feature`
91+
* Lint with standard `npm run lint`
92+
93+
## License
94+
95+
This software is released under the MIT license. See [the license file](LICENSE) for more details.

0 commit comments

Comments
 (0)