@fabricematrat
fabricematrat@gmail.com
Pros
Cons
Hybrid client/server view rendering with Grails
See Rob Fletcher Presentation @GR8Conf US
http://blog.mwaysolutions.com/2013/11/08/client-vs-serverside-rendering-the-big-battle-2/
Authors: Burt Beckwith
HTML resource management enhancements to replace g.resource
Marc Palmer, Luke Daley, Peter N. Steinmetz
//=require ember
//=require handlebars
//=require_self
//=require_tree helpers
//=require_tree models
//=require_tree controllers
//=require_tree views
MyApp = Ember.Application.create({
ready: function() {
console.log("Application Launched!");
}
});
Venkat Subramaniam
JQUERY FOR GRAILS DEVELOPERS
Pros
Cons
More than 3400 plugins
No more built-in tasks
npm install -g grunt-cli
grunt --version
uglify: {
build: {
files: {
'build/js/base.min.js': ['assets/js/base.js']
}
}
}
var gulp = require('gulp'),
stylus = require('gulp-stylus'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('default', function() {
return gulp.src('src/styles/*.styl')
.pipe(stylus())
.pipe(autoprefixer())
.pipe(gulp.dest('public/styles'));
});
http://todomvc.com around 70 MVCs
The future of JS is module not frameworkJohn Hann
a package is a set of one or more modules that are meant to work together
a module is a way of exposing an Object or a function, respecting isolation, namespacing and private state
var MODULE = (function () {
var my = {};
var privateVariable = 1;
function privateMethod() {
// ...
}
my.moduleProperty = 1;
my.moduleMethod = function () {
// ...
};
return my;
}());
var my_module = new MODULE();
npm install angular
npm uninstall angular
npm update angular
npm search angular
and
bower install --save backbone
bower uninstall --save backbone
bower-update //to update properly
bower search backbone
http://addyosmani.com/writing-modular-js
MODULE.js
var privateVariable = 1;
var privateMethod = function () { // ... };
exports.moduleMethod: function () { // ... };
someplace.js
var my_module = require(‘./MODULE’);
MODULE.js
define(function () {
return function() {
var privateVariable = 1;
var privateMethod = function () { // ... };
return function () { // ... };
};
});
someplace.js
define(['MODULE'], function (my_module) {
});
MODULE.js
export function MODULE() {
var privateVariable = 1;
var privateMethod = function () { // ... };
// ...
};
someplace.js
import my_module from './MODULE';
description, licence, version, ignore, keywords
authors, homepage, repository, private
{
"name": "wire",
"version": "0.10.9",
"main": "./wire.js",
"moduleType": ["amd"],
"dependencies": {
"meld": "~1",
"when": "~3",
"poly": "~0"
},
"devDependencies": {
"curl": "~0",
"requirejs": "~2",
"requirejs-domready": "~2",
"sizzle": "~1",
"jquery": "~1",
"dojo": "~1",
"dijit": "~1"
}
}
description, keywords, homepage, bugs, ...
{
"name": "wire",
"version": "0.10.9",
"dependencies": {
"meld": "~1",
"when": ">=2.6.0 "
},
"devDependencies": {
"buster": "~0.7",
"bower": "~1",
"gent": "~0.6"
},
"main": "./wire",
"directories": {
"test": "test"
},
"scripts": {
"test": "buster-test -e node",
"prepublish": "bower install"
}
}
data-rave-meta="bower.json, package.json"
npm install --save angular
bower install --save when
an ES6 Loader polyfill built in
Dynamically loads ES6 modules in current browsers
In Browser Console, type rave()
HTML attribute
No :(
Let' try it with angular !
define({
helloWired: {
create: {
module: 'app/hello-wired',
args: { $ref: 'dom.first!hello' }
},
init: {
sayHello: { $ref: 'message' }
}
}
});
var origDoSomething = thing.doSomething;
thing.doSomething = function() {
doSomethingElseFirst();
return origDoSomething.apply(this, arguments);
}
var myObject = {
doSomething: function(a, b) { return a + b; }
};
// Call a function after myObject.doSomething returns
var remover = meld.after(myObject, 'doSomething', function(result) {
console.log('myObject.doSomething returned: ' + result);
});
myObject.doSomething(1, 2); // Logs: "myObject.doSomething returned: 3"
remover.remove();
myObject.doSomething(1, 2); // Nothing logged
todos: {
create: {
module: 'cola/Collection',
args: {
strategyOptions: {
validator: { module: 'app/create/validateTodo' }
}
}
},
before: {
add: 'cleanTodo | generateMetadata',
update: 'cleanTodo'
}
}
meld + wire = <3
Let' try RaveJS + CujoJS !