Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple preprocessors #662

Closed
evil-shrike opened this issue Sep 1, 2016 · 5 comments
Closed

Multiple preprocessors #662

evil-shrike opened this issue Sep 1, 2016 · 5 comments

Comments

@evil-shrike
Copy link

@evil-shrike evil-shrike commented Sep 1, 2016

docfx supports template merging. It's useful for custom templates when we have not to reimplement all logic from default template in our custom one. But if I want to add my own preprocessor (to add a field into view model) I have to copy almost all default template items.
For example if I want to extend ManagedReference.html.primary.js and created such the file in my template then standard login from default template won't run. So I have to copy default ManagedReference.html.primary.js and patch it. But then I also have to copy common.js and ManagedReference.common.js. So I'm quickly loosing merging capabilities and have to synchronize my template with every new version.
It would be nice to have an ability to add a preprocessor in custom template and keep standard preprocessors running.

@superyyrrzz
Copy link
Contributor

@superyyrrzz superyyrrzz commented Sep 2, 2016

You can put your ManagedReference.html.primary.js in a folder, like customized_template, and specify template in docfx.json like "template": ["default", "customized_template"]. Then you needn't copy common.js and ManagedReference.common.js. You need to synchronize only ManagedReference.html.primary.js in new version, and this won't change frequently.

@evil-shrike
Copy link
Author

@evil-shrike evil-shrike commented Sep 3, 2016

When I created ManagedReference.html.primary.js in my template ManagedReference.html.primary.js in default template stopped running.

@superyyrrzz
Copy link
Contributor

@superyyrrzz superyyrrzz commented Sep 4, 2016

Your ManagedReference.html.primary.js will overwrite the one in default template, so you should copy all the codes in the default, then add your parts.

@evil-shrike
Copy link
Author

@evil-shrike evil-shrike commented Sep 5, 2016

This is exactly what I talked about - quickly we have to copy everything.

@superyyrrzz
Copy link
Contributor

@superyyrrzz superyyrrzz commented Oct 31, 2016

@evil-shrike Now we expose 2 methods for preprocessor file. You can find documents here This will ship with today's release v2.7

@vicancy vicancy closed this May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.