0.2.1 • Published 9 years ago

grunt-file2json v0.2.1

Weekly downloads
2
License
-
Repository
github
Last release
9 years ago

grunt-file2json

Parses file names of a specific format into a JSON file

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-file2json --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-file2json');

##API newpath: Basepath you want to use in the filepath dest: String: A path/to/filename that describes the destination of the JSON file, src: String: A path/to/markdownDirectory that describes the source of the markdown directory, priority: String: name of the appropraite subdirectory that will be marked in the JSON file with a "priority": "true" attribute, template: String: templates how the JSON structure will come out, filepath: Boolean: if true, an addition filepath attribute will be appended to each JSON object.

###Sample Option

file2json: {
  target: {
    cwd:'source/files/foo',
    newpath: 'files/foo/',
    dest:'foo/bar.json',
    src:'baz/bar/foo',
    priority:'subdirectory2',
    template:'foo-bar-baz',
    filepath: true
  }
}

This would grab all the markdown files from the subdirectories in the directory 'baz/bar/foo', and create a JSON file in 'foo/bar.json'. The JSON would look something like this:

[
...
{
    "foo": "subdirectory1",
    "bar": "blah",
    "baz": "blah",
    "filepath": "/baz/bar/foo/subdirectory1/foo.Name-bar.Name-baz.Name.md",
    "slug":"foo-Name_bar-Name_baz-Name"
},
{
    "foo": "subdirectory2",
    "bar": "blah",
    "baz": "blah",
    "filepath": "/baz/bar/foo/subdirectory2/fooName-barName-bazName2.md",
    "priority": "true",
    "slug":"foo-Name_bar-Name_baz-Name2"
},
...
]
0.2.1

9 years ago

0.2.0

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago