Skip to content

Instantly share code, notes, and snippets.

@fredsterss
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredsterss/9459007 to your computer and use it in GitHub Desktop.
Save fredsterss/9459007 to your computer and use it in GitHub Desktop.

Noobs guide to components.

Bro. component.io

Using components within an existing project

All components compile to a global build.js and build.css from the command line, so the only restriction on the framework you are using is that you can include those from the main template.

1. Install component

With node previously installed:

 $ npm install -g component

With node binary on OSX:

 $ (cd /usr/local && \
    curl -L# http://nodejs.org/dist/v0.8.15/node-v0.8.15-darwin-x86.tar.gz \
    | tar -zx --strip 1) \
   && npm install -g component \
   && printf "installed component(1) %s\n" $(component --version)

NOTE: tested with node 0.8.x

2. Create component.json in the root of your project:

{
  "name": "My cool project name",
  "dependencies": {
    "fredsterss/image-zoom": "*"
  }
}

####3. Fetch and install your components component install

####4. Build your components! component build

To build to a specific location: component build --out path/to/dir

Why use components?

Because they are a great way to organise your front end code, and access powerful functionality without having to depend on bloated libraries.

@kirillzubovsky
Copy link

npm install -g component didn't work for me, until I rooted it. fyi

@kirillzubovsky
Copy link

Another question. Once I built a component, like yours that depends on a ton of others, do I only include yours into my asset path, or do I need to grab a whole bundle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment