Well in short it's a Famo.us package system inside of the Meteor.js Package system - or is it requireJS? one could actually remove the standard-app-packages
from the app and have a pure Famo.us app.
$ mrt add famono
Requires: Meteor
, Meteorite
and ofcourse git
all easy to install
What? Well - you can add any library code you want to - even none Famo.us stuff.
How:
When you install the package you will get a lib/smart.require
in your main app folder, and it would look something like:
{
"famous": {
"git": "https://github.com/Famous/famous.git"
},
"famous-polyfills": {
"git": "https://github.com/Famous/polyfills.git"
}
}
you can mount any git repo on a namespace, oh and in Meteor editing this file will trigger either an add/download or removal of the changed namespace - LIVE.
This enables you to do:
// Rig some famo.us deps
require("famous-polyfills"); // Add polyfills
require("famous/core/famous"); // Add the default css file
// Basic deps
var Engine = require("famous/core/Engine");
var Modifier = require("famous/core/Modifier");
var RenderController = require("famous/views/RenderController");
// Make sure dom got a body...
Meteor.startup(function() {
var Surface = require("famous/core/Surface"); // This one needs document.body
var mainContext = Engine.createContext();
var renderController = new RenderController();
var surfaces = [];
var counter = 0;
for (var i = 0; i < 10; i++) {
surfaces.push(new Surface({
content: "Surface: " + (i + 1),
size: [200, 200],
properties: {
backgroundColor: "hsl(" + (i * 360 / 10) + ", 100%, 50%)",
lineHeight: "200px",
textAlign: 'center'
}
}));
}
renderController.show(surfaces[0]);
Engine.on("click", function() {
var next = (counter++ + 1) % surfaces.length;
this.show(surfaces[next]);
}.bind(renderController));
mainContext.add(new Modifier({origin: [.5, .5]})).add(renderController);
});
Nope - the package scans your code and figure outs dependencies at your edit.
Force clean dep registry:
- edit
lib/smart.require
set it to{}
empty and save - restore
lib/smart.require
with the deps you had in there and save
Setting git references specific you can.
You can set either a branch or tag (if both is set only tag is used)
{
"foo": {
"git": "https://github.com/Foo/bar.git"
"branch": "master",
"tag": "v1.0.0",
"recursive": false // default is true, true == load submodules
}
}
Note: "git" can be set to local folders too if developing locally. But you may have to force reset if referenced code has changed.
You can create a repo and have the user add it to the project just like the Famo.us
packages.
Kind regards Morten (aka raix)