GitXplorerGitXplorer
A

grunt-architect

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
7ec52d64059a9d26dfe817cea4dd16712ee1b8fe

added description to package.json

AAratramba committed 11 years ago
Unverified
484cc516b4374f76ec71a22c5b63bbb8786940aa

initial version

AAratramba committed 11 years ago
Unverified
885f0a1835ece741d1ddb351831aaba3c46d0ee0

added dependencies

AAratramba committed 11 years ago
Unverified
153a42c52b8437d85d61bf138cc87e0698754a90

removed direct cheerio dependency; updated readme

AAratramba committed 11 years ago
Unverified
2443c1369470d6200d389e4342270be577548728

updated readme

AAratramba committed 11 years ago
Unverified
58eb2cab422e5bfc1e438ee409709ee44b734a56

updated readme

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.