Currently, adding TemplateStyles from a lua module requires including the following in the returned value:
mw.getCurrentFrame():extensionTag( 'templatestyles', '', { src = 'Module:Script doc auto/styles.css' } )or with named args:
mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Script doc auto/styles.css' } }We could add a Lua library in TemplateStyles to simplify it down to:
mw.ext.templatestyles.add( 'Module:Script doc auto/styles.css' );
(name up for bikeshedding, add is probably a bit misleading as it implies a side-effect-causing void function, when in reality it returns the extension tag)
While viewing the module, there's currently no easy way to navigate to the TemplateStyles page. A function like the above also enables SyntaxHighlight to make the link clickable similar to require(), mw.loadData() and mw.loadJsonData().