Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added input to configure cloudfront compression #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ inputs:
bucketName: my-bucket # (optional) aws bucket name. default is an auto generated name.
indexDocument: index.html # (optional) index document for your website. default is index.html.
errorDocument: index.html # (optional) error document for your website. default is index.html.
compress: false # (optional) enables cloudfront automatic compression. default is false.
```

You could also provide a build hook to run before the source gets uploaded by turning the `src` input into an object:
Expand Down
3 changes: 2 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const getConfig = (inputs, state) => {
config.region = inputs.region || state.region || 'us-east-1'
config.bucketUrl = `http://${config.bucketName}.s3-website-${config.region}.amazonaws.com`
config.src = inputs.src
config.compress = inputs.compress || false

config.distributionId = state.distributionId
config.distributionUrl = state.distributionUrl
Expand Down Expand Up @@ -560,7 +561,7 @@ const createCloudFrontDistribution = async (clients, config) => {
SmoothStreaming: false,
DefaultTTL: 0,
MaxTTL: 31536000,
Compress: false,
Compress: config.compress,
LambdaFunctionAssociations: {
Quantity: 0,
Items: []
Expand Down