Created
December 20, 2020 01:58
-
-
Save AndrewBuntsev/8658936264dce3c65775fea35543847d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const AWS = require("aws-sdk"); | |
const cognitoIdentityServiceProvider = new AWS.CognitoIdentityServiceProvider({ region: 'us-east-1' }); | |
const styles = fs | |
.readFileSync("styling.css", "utf8") | |
.replace(/(\r\n\t|\n|\r\t)/gm, "") //remove newlines | |
.replace("/*.+?*/"); // remove comments | |
const image = fs.readFileSync('logo.png'); | |
const params = { | |
UserPoolId: '<your-user-pool-id>', | |
CSS: styles, | |
ImageFile: Buffer.from(image) | |
}; | |
cognitoIdentityServiceProvider.setUICustomization(params, (err, data) => { | |
if (err) console.log(err, err.stack); // error | |
else console.log(`Successfully updated, new css version: ${data.UICustomization.CSSVersion}`); // successful response | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment