-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70199a6
commit c36ae8e
Showing
1 changed file
with
11 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
const pluginCloudCannon = require('eleventy-plugin-cloudcannon'); | ||
|
||
let defaultConfig; | ||
|
||
try { | ||
defaultConfig = require('./default-eleventy.config.js'); | ||
} catch (e) { | ||
console.error('⚠️ Unable to require your config from eleventy-plugin-cloudcannon:', e); | ||
} | ||
|
||
// Used when the 'Manage eleventy-plugin-cloudcannon manually' option is disabled in CloudCannon. | ||
// Adds this plugin after running the renamed default config file. | ||
module.exports = function (eleventyConfig, ...args) { | ||
let defaultConfig; | ||
|
||
try { | ||
defaultConfig = require('./default-eleventy.config.js'); | ||
} catch { | ||
console.error('Not found: ./default-eleventy.config.js'); | ||
} | ||
|
||
console.log('🔮 Starting automatic eleventy-plugin-cloudcannon'); | ||
const config = defaultConfig?.apply?.(this, [eleventyConfig, ...args]) ?? {}; | ||
console.log('☑️ Processed default configuration for eleventy-plugin-cloudcannon'); | ||
eleventyConfig.addPlugin(pluginCloudCannon, eleventyConfig.cloudcannonOptions ?? config); | ||
console.log('☑️ Finished eleventy-plugin-cloudcannon'); | ||
return config; | ||
}; |