* Grab the config JSON string, parse it into an object, grab the current variation, * and then merge it into the top level settings. * * @returns {object}
()
| 28 | * @returns {object} |
| 29 | */ |
| 30 | async getConfig() { |
| 31 | const config = await this.getRawConfig(); |
| 32 | const variation = this._getVariation(config, this.variationIndex); |
| 33 | this.globalSettings = cloneDeep(config.settings); |
| 34 | if (!this.currentVariationSettings) { |
| 35 | this.currentVariationSettings = variation.settings; |
| 36 | } |
| 37 | // Set some defaults |
| 38 | config.css_compiler = config.css_compiler || 'scss'; |
| 39 | config.autoprefixer_cascade = config.autoprefixer_cascade || true; |
| 40 | config.autoprefixer_browsers = config.autoprefixer_browsers || [ |
| 41 | '> 1%', |
| 42 | 'last 2 versions', |
| 43 | 'Firefox ESR', |
| 44 | ]; |
| 45 | // Merge in the variation settings and images objects |
| 46 | config.settings = defaultsDeep(this.currentVariationSettings, config.settings || {}); |
| 47 | config.images = defaultsDeep(variation.images, config.images || {}); |
| 48 | config.variationName = variation.name; |
| 49 | return config; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Updates the current variation settings |
no test coverage detected