nickberens360 / atomic-docs

Front end code documentation generator. http://atomicdocs.io/
GNU General Public License v3.0
780 stars 92 forks source link

Components as template files? #8

Closed cdCorey closed 8 years ago

cdCorey commented 8 years ago

All the examples show the components as HTML files. Is it necessary for them to be HTML, or can this support PHP or other template languages?

rafaellyra commented 8 years ago

acctualy they are already php files by default as you can see in the box sample, but I think that would be a good improvement to use a template language as twig or something else

nickberens360 commented 8 years ago

@cdCorey and @rafaellyra

In atomic-config.php you can set the component extension to whatever you'd like.

$config = array(); $config['dir'] = dirname(FILE);

//user defined varibales $config['preCssDir'] = 'scss'; //Scss preprocessor directory name. E.G sass $config['preCssExt'] = 'scss'; //prerocessed file ext. E.G. scss $config['compExt'] = 'php'; //markup file ext. E.G. html, twig, etc...

return $config;

cdCorey commented 8 years ago

Excellent. In the videos it showed a .html extension, which is why I was unsure.

I assume the intention is mainly to be able to display the component in the style guide, but ideally it would be great to use the component files directly in live site templates (to keep it DRY). I imagine there could be problems with displaying in the style guide if you use a template type AtomicDocs isn't designed for, though. Would it make sense to support plugins to AtomicDocs to process different template languages, or something like that?

nickberens360 commented 8 years ago

@cdCorey

In theory, you can give access to your application's functions and data in atomic-head.php. Then you should be able to use your templating language in the components.

I do this with WordPress sites all the time by including wp-load.php in atomic-head.php giving me access to wp's functions. Then I can use the wp_query function, for example, in my components.

Then I just include that component in my theme wherever I need it. Both AtomicDocs and wherever I include the component will remain up to date.

cdCorey commented 8 years ago

Booya.

Corey Caswick Chatman Design chatmandesign.com http://www.chatmandesign.com

On Tue, Jun 7, 2016 at 10:20 AM, Nick Berens notifications@github.com wrote:

@cdCorey https://github.com/cdCorey

In theory, you can give access to your application's functions and data in atomic-head.php. Then you should be able to use your templating language in the components.

I do this with WordPress sites all the time by including wp-load.php in atomic-head.php giving me access to wp's functions. Then I can use the wp_query function, for example, in my components.

Then I just include that component in my theme wherever I need it. Both AtomicDocs and wherever I include the component will remain up to date.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nickberens360/atomic-docs/issues/8#issuecomment-224314734, or mute the thread https://github.com/notifications/unsubscribe/AE1wfj2WcnOYOy4YwJ8oTdxddF8AmcTsks5qJYwlgaJpZM4Iv-lz .