decomponentify1

0.8.2 • Public • Published

decomponentify1

A browserify transform to enable the easy use of componentjs components in browserify client javascript projects.

Shamelessly copied from debowerify

build status

Installation

Installation is via npm:

$ npm install decomponentify1

How to use.

Install some components directly from github:

$ component install components/underscore

Require the component file by it's component identifier (ie. in this case "underscore"):

// public/scripts/app.js
var _ = require('underscore'); // the remote component directly from github
var $ = require('jquery');     // from bower via debowerify
var domready = require('domready'); // a regular browserify npm component
 
domready(function () {
  var button = document.getElementById('fullscreen');
  button.addEventListener('click', function (evt) {
   evt.preventDefault();
    var name = 'harry';
    var templateData = $('#sayHello').text();
        var compiled = _.template(templateData, {'data': name });
        $('#helloDiv').html(compiled);
  });
});

Build out your browserify bundle using the decomponentif transform:

$ browserify -t decomponentify1 public/scripts/app.js -o public/scripts/build/bundle.js

Then include your bundle.js in your HTML file and you're done!

Package Sidebar

Install

npm i decomponentify1

Weekly Downloads

1

Version

0.8.2

License

BSD

Last publish

Collaborators

  • frankwallis