evanmoran / oj Goto Github PK
View Code? Open in Web Editor NEWUnified web templating for the people. Thirsty people.
License: MIT License
Unified web templating for the people. Thirsty people.
License: MIT License
It appears that OJ can't be used with requirejs. This is because it attempts to write to module.exports
when require
is available, but requirejs does not have module.exports
(or module
).
I would just add a guard that checks to see if module
is not undefined
before assigning to module.exports
.
I've read in PR history that this lib supports Browserify but I can't find a working example. I'm trying:
oj = window.oj = require "ojs"
With Error: Cannot find module './oj.coffee' from '/path/to/node_modules/ojs/dist'
. I've tried requiring ojs/dist/OJ
but again, no luck.
Command line tool embeds inline a lot of styles and scripts (especially scripts). Perhaps it does not matter in case of single page applications, but with more than one page it brings redundancy.
May be it is possible to automatically split generated code into separate .css, .js and .html (which includes them).
I think that OJ has a potential to be more universal tool than just a view component for client-side applications. It could be, for example, very elegant static site generator which requires you to write only one concise .oj/.ojs per page, instead of dealing with separate verbose .html, .css and .js files.
This plugin is in the works. The main challenge is improving performance through caching.
It turns out a gigantic amount of time is taken up in require
traversal (which cannot be async) and minification (which can be). Both of these can be cached but it will take time to factor out traversal and minification from compiling.
Running npm install oj
followed by ./node-modules/.bin/oj
throws an uncaught exception:
module.js:340
throw err;
^
Error: Cannot find module 'coffee-script'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/hudon/Dropbox/MyCode/web/jsjsjs/node_modules/oj/generated/server.js:13:12)
at Object.<anonymous> (/home/hudon/Dropbox/MyCode/web/jsjsjs/node_modules/oj/generated/server.js:1197:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
hey evan, found something curious happening when there's an insert, followed by a click listener - the click listener triggers somehow during the insert.
if you change either one to another listener, or even change the order of the listeners, it works as expected.
cheers
$("body").oj(
div {
insert:->
console.log "insert"
click:->
alert('this runs on insert')
}
)
Within oj.js
, I saw the term ojml
and a parser pop up, but did not find anything about it inside the docs, so far. Could you maybe explain or document it? Thanks!
Hey Evan,
Have you considered registering OJ into the Bower repository?
Thanks,
Dmitry
Should be a simple fix, but requires a global OJ cache (should be little overhead) so changes to css at runtime can override previous changes!
I just wanted to ask if the state of compatibility with known jQuery alternative is currently tested or known? I want to see if I can get away from jQuery to a smaller, thinner alternative.
The info variable in the oj.copyProperty method is occasionally undefined causing the whole app to stop.
I worked around it this way:
oj.copyProperty = function(dest, source, propName) {
var info;
info = Object.getOwnPropertyDescriptor(source, propName);
if (info === undefined) {
info = {
value: [],
enumerable: false,
writable: false,
configurable: true
};
}
if (info.value != null) {
info.value = _clone(info.value);
}
return Object.defineProperty(dest, propName, info);
};
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/with
Many scripts and libraries use "use strict";
. In order to not run into complications, OJ probably should extend into the scope that it wants to. In the case of a rendering sequence:
(function(){try{ oj.extendInto(this); (function(){
h1("Foo bar");
}).apply(this);}catch(e){ handle_error(e); }})();
Just a thought, since I just read the article.
These libraries are essential and should be included in the main javascript file.
I had install oj -g , but it's throw this error when i type oj in commandline
/usr/local/lib/node_modules/oj/oj.js:339
info = _extend({enumerable: true, configurable: true}, info)
^
TypeError: undefined is not a function
Add support for bulk adding multiple rows on oj.Table and oj.List
Hi Evan, one thing I've been getting stuck with is a nice way to attach events to dom elements once they're loaded.
Something like this:
span {
load: -> $(this).animate({...})
}, "hi"
What would be the way you recommend to do this?
reactive coffee made a 'init' method, in addition to the available jquery listeners, but maybe there's already a clever way to do it.
Cheers,
OJ has release versions, but the tags don't exist on GitHub.
hey evan, sorry if this is already somewhere, what would you recommend for including svg in oj syntax?
there's like a billion types of elements in that spec..
should i make a plugin? or is there a way to do something like:
div ->
svg ->
path {d:"M0,0L9,7L18,0"}
I'm incorporating oj.Form into the core. It is just having too many dependencies with other projects (oj.Bootstrap coming soon). It turns out form validation and creation is just too fundamental to leave out. For the same reason I'm leaving oj.List and oj.Table in the core as well.
Should be an easy fix, but tracking this here for now.
Okay, I am just too tempted.
I started on making up a concept for a project that combines two OJ projects that I know into one:
My resulting, still draft, concept: https://github.com/IngwiePhoenix/o.o
Opinions, thoughts? :)
Hi Evan,
Here's the gist: https://gist.github.com/dminkovsky/7142760
The gist is that you need to get underscore-amd
and backbone-amd
with Bower, and then OJ works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.