SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

How to add custom annotations in ES6? (Default theme) #513

Closed MathiasSM closed 6 years ago

MathiasSM commented 6 years ago

The official docs only mention modules.exports = () => {/*..theme stuff..*/}; module.exports.annotations = () => { return {name: "blah", /* ... */} }. But the default theme uses ES6. The whole sassdoc code uses ES6 modules, and I just haven't figure out how to make it work.

It just seems to me that export {annotations} should work (but does not).

MathiasSM commented 6 years ago

Well, I figured it out. One does not need to export another object besides the default. The theme main function should have the added annotations property.

function theme (a, b){
  /*...*/
}
theme.annotations = [];
theme.annotations.push(() => {
  return { name: "blah", /*...*/ }
}
export default theme;