verless / verless

A Static Site Generator designed for Markdown-based content with a focus on simplicity and performance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move core.loadPlugins function into plugin package

dominikbraun opened this issue · comments

In core/build.go, there's a small function called loadPlugins. This function returns a simple map containing all plugin keys and a corresponding function that loads the plugin - i.e. it simply returns an instance.

verless/core/build.go

Lines 301 to 311 in 16673b1

// loadPlugins returns a map of all available plugins. Each entry
// is a function that returns a fully initialized plugin instance.
func loadPlugins(cfg *config.Config, fs afero.Fs, outputDir string) map[string]func() Plugin {
plugins := map[string]func() Plugin{
"atom": func() Plugin { return atom.New(&cfg.Site.Meta, fs, outputDir) },
"tags": func() Plugin { return tags.New() },
}
return plugins
}

I have no idea why this function is inside the core package. It should be inside the plugin package. The best way would be to just move it into a new file plugin/plugin.go. The function signature can remain unchanged.

Hey @dominikbraun, I'll take this one

@dominikbraun, could you please review PR #211