Which files can you override from a plugin?

(Orlando Del Aguila) #1

I’m creating a plugin that overrides a lot of files for a pretty much complex customization of Discourse. I was able to override most of the file except for the ones in the components directory. Is this expected?, is so, which files you can override and which files you can’t?


(Vinoth Kannan) #2

You can modify components easily via PluginApi like below example

You can modify almost any file in one way or the other. PluginApi methods are better and recommended.

(Orlando Del Aguila) #3

What about changing the tagName? or other things that are not in a method? is it possible too?

(Vinoth Kannan) #4

Yes. It is simple as

api.modifyClass('component:site-header', {
  tagName: 'section'

Anyway I recommending you to play around with the code before asking :wink:. And explore the guides, existing code, and plugins.

(Orlando Del Aguila) #5

Cool, this is an alternative approach, but I want to know if there’s a restriction on the files you can override from a plugin?

(Vinoth Kannan) #6

No. Discourse core won’t restrict any plugin abilities.

(Orlando Del Aguila) #7

Ok cool, so overriding files from the components directory should work. I’ll double check then