-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Vue-Herman integration playground #4
base: master
Are you sure you want to change the base?
Conversation
I see two aspects to the Vue-Herman documentation integration:
At first, we were discussing having all of the Herman-related documentation in a separate SFC block (e.g. a We started trying to tackle the second part -- rendering a Vue component with sample data/props. Our first attempt used vue-server-renderer within Herman to try to grab a component by name and render it within Herman. We pretty quickly ditched that approach, realizing there wasn't a good reason to require users to write their components in such a way that they could be compiled via node as well as in the browser. So, we thought, let's just have Herman render an I think the first step is sorting out what info needs to be made available to Herman at build-time, and what can just be available to Herman or the component at runtime. I'm happy to help out as I'm able -- I know the internals of Herman pretty well, but have a much more cursory understanding of Vue and vue-loader, so take these thoughts with a large grain of salt! |
I'm excited to work on this. 😃 Can you give an example of the JavaScript input Herman needs and how to provide it to Herman? For example, if Herman needs an array of objects, each object representing a component, what would those objects look like, minimally? I think that would help me start building an integration (and know when it's working 😅). Does that make sense? |
That's a great question, and the answer is basically "that's up to us". But some rambling thoughts... Currently Herman does not have parsing of anything other than Sass (we used to have a In the end, the SassDoc parser sends Herman a That doesn't really answer your question of how to get the info to Herman. I imagine we'd want to add a top-level In this playground repo, the static SassDoc/Herman options are defined in the webpack config file (https://github.com/oddbird/herman-test-project/blob/master/webpack.config.js#L33-L56), and then passed into a custom sassdoc-webpack-plugin (https://github.com/oddbird/herman-test-project/blob/master/sassdoc-webpack-plugin.js) along with some options for webpack-compile-time Herman options (e.g. filepaths to generated assets: https://github.com/oddbird/herman-test-project/blob/master/webpack.config.js#L88-L94). So... maybe the vue-loader or webpack-plugin or whatever generates a JSON file and we just pass that (or a path to it) into Herman as an option? Then Herman reads that file and inserts the data into the context before rendering the docs? (We're doing something similar already with That doesn't really solve the problem of actually rendering a Vue component -- I'm less clear on how Herman gets the necessary info there. At the very least a JS file with the Vue component to render at runtime, I'd think... |
I should add, there are a lot of moving parts here (and I'm not even 100% clear on what all they are!), but I'm happy to help out as I can -- especially on the Herman side. So if you can help get info to Herman (either in the form of JS objects, or filepaths to said objects), I'll be more useful in figuring out what Herman does with that data. |
Thanks - that's great information! So maybe as a first step, I could generate an array of objects from |
Yep, that sounds perfect! 👏 |
To answer the question for me… Yes, at this point we're just talking about documentation from within the Vue SFC. There are some nice-to-have additions that we should keep in mind, but don't have to happen in this PR:
|
Playground for oddbird/sassdoc-theme-herman#168