GitXplorerGitXplorer
A

grunt-architect

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
f4793d2836475db637459f2433640e57c0e27942

updated readme

AAratramba committed 11 years ago
Unverified
0a195f6b3f87c7cdeadd19978226d94b3e8560a3

included html-comments package

AAratramba committed 11 years ago
Unverified
a7e83fb782cac9a061c30835fd3ecb79b2d55327

updated description

AAratramba committed 11 years ago
Unverified
d70155d7da27d47960f23daf3bd552c88662ccf6

added support for multiple keys; tests

AAratramba committed 11 years ago
Unverified
c6b2d7333b6f8b0b8638a620c98a5cb962fdb374

working on tests

AAratramba committed 11 years ago
Unverified
fa206c05a3c5365746677c92ab1bac5de858fd55

added keyword option, moved tests around; no actual tests yet

AAratramba committed 11 years ago

README

The README file for this repository.

Grunt Architect

Populate a JSON file right from your HTML comments. Use json, yaml or cson to store your data.

<div>
    <!-- architect
    some description
    ---
        path: foo
        baz: baz
        bar: bar
    -->
</div>

and output that to blueprints.json

{
    "foo": {
        "baz": "baz",
        "bar": "bar"
    }
}

Grunt setup

architect:
  all:
    files: {
      'blueprints.json': ['fileA.html', 'fileB.html']
    }

or with custom options

architect:
  all:
    options: {
        parser: 'yaml'
        keyword: 'mycustomkeyword'
        template: {
            foo: {
              baz: "baz"
            }
        }
    }
    files: {
      'blueprints.json': ['fileA.html', 'fileB.html']
    }

parser 'yaml'
yaml | cson | json.

keyword architect
keyword used to collect comments.

template {}
json object to use as a basis for the blueprints file.

Architect

Make sure you write valid yaml, json or cson. Yaml is probably easiest to write.

Everything you write after keyword and before the beginning of your object will be ignored. Might be a nice place for some descriptive piece of text (let's call it a comment comment).

Variables

path (required)
Use the path variable to specify a json-path. This is the dot-notated path to where your object will be stored in the outputted json.

<!-- architect
I am a great grandchild
---
    path: family.child.grandchild
    greatgrandchild1:
        description: 'im a great-grandchild'
-->

So when path is family.child.grandchild, your object will be placed at the ...

{
    "family": {
        "child": {
            "grandchild": {
                ...
            }
        }
    }
}

An object will be created for every key that doesn't exist.