GitXplorerGitXplorer
A

grunt-architect

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
77b644fa2445f12859f7ae6c7dd416af9e6ca9e1

undated readme

AAratramba committed 11 years ago
Unverified
bca5032f0c82402723efd0cb05060308da06ff41

working on tests

AAratramba committed 11 years ago
Unverified
acc977f0cdc6aa2dfed73e355d10ded178bfdaed

Merge branch 'yaml'

AAratramba committed 11 years ago
Unverified
8c3ad2d701acebd687a1e3035d01d93f2d21f9a8

added cson/yaml/json options

AAratramba committed 11 years ago
Unverified
417fcdef2bf4c06798b5d15d4619077d388876b2

added test files

AAratramba committed 11 years ago
Unverified
fac09139bdaa2206b852a772f8aaabce14c87c77

moved $, grunt to architect.init

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.