Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A plugin to convert JSON files for the component builder.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
.gitignore
Makefile
README.md
index.js
package.json

README.md

component-json

A plugin to convert JSON files for the component builder.

Install

$ npm install component-json

Usage

Add your .json files to the files array in your component.json:

  {
    "files": [
      "data.json"
    ]
  }

Use the plugin during your build process:

  var fs      = require('fs')
    , Builder = require('component-builder')
    , json    = require('component-json');

  var builder = new Builder(__dirname);

  builder.use(json);

  builder.build(function(err, res){
    if (err) throw err;
    fs.writeFileSync('build/build.js', res.require + res.js);
    if (res.css) fs.writeFileSync('build/build.css', res.css);
  });

And then require the files in your Javascript:

  var tip  = require('tip')
    , data = require('./data.json');
Something went wrong with that request. Please try again.