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

Custom fields support #57

Open
robhrt7 opened this issue Mar 14, 2015 · 5 comments
Open

Custom fields support #57

robhrt7 opened this issue Mar 14, 2015 · 5 comments

Comments

@robhrt7
Copy link

robhrt7 commented Mar 14, 2015

Could you please add custom fields support in parser?

/**
  * @name Button
  * @description Your standard form button.
  * 
  * @custom Some custom info
  * @templateName Link to template
  * 
  * @markup
  *   <button class="button">This is a button element</button>
  */

This fields will allow to integrate some custom features on top, like template include support. We would really love this feature for our SourceJS integration.

@robhrt7
Copy link
Author

robhrt7 commented Mar 14, 2015

I guess its possible to configure with custom parsers as well?

@ahx
Copy link
Contributor

ahx commented Mar 18, 2015

@operatino Do you just want to add a new field, called "custom" in your example? – This is doable by adding a parser like:

var dss = require('dss');
dss.parser('custom', function(i, line, block){
  return line;
});

@darcyclarke
Copy link
Member

@operatino Custom parsers are your friend here. Here's an example (basically the same as @ahx's):

Example Custom CSS/Comment:

// ...
// @custom Some custom info
// ...

Example Custom JavaScript/Parsers:

// Parser for @custom
dss.parser( 'custom', function( i, line, block ) {
  return line;
});

Example Custom HTML/Template (using grunt-dss):

{{#files}}
  {{#blocks}}
     <h1>{{custom}}</h1>
  {{/blocks}}
{{/files}}

@robhrt7
Copy link
Author

robhrt7 commented May 9, 2015

Why you don't want to add custom fields automatically, without defining a custom parser? JSON could be just auto populated with custom fields, following default parsing strategy.

@darcyclarke
Copy link
Member

Ahhh, sorry @operatino, I didn't realize what you meant before. We can definitely make a very simple change that would allow any custom variable to be parsed properly/fallback and then if you want to do something special on top of that default then you could define a custom parser. I like this and it makes a lot of sense. I'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants