Skip to content

Commit

Permalink
Commit 65 (v1.0.0-beta.65 - Beta Candidate)
Browse files Browse the repository at this point in the history
BREAKING CHANGES AND IMPROVEMENTS

- The global namespace when JsRender is loaded without jQuery
  is now window.jsrender. (Previously it was window.jsviews).
  So when using JsRender without jQuery, you can write:
  var $ = jsrender; - and use the $ var it in the same way you
  would use the global $ when JsRender is loaded with jQuery:
  e.g. $.templates(...) or $.views.helpers(...) etc.

- AMD support has been improved and simplified. All AMD
  modules, including JsRender, with or without jQuery, now
  return the jQuery object (if loaded) or the analogous
  JsViews object.

- Node.js support and integration has been improved - along
  with improved CommonJS support, and Browserify integration.
  The file system APIs now use the syntax tmpl="./file/path.html".
  The Node.js version of jsrender.js is available as a separate
  file (available at //jsviews.com/download/jsrender-node.js).

  The Node.js version of JsRender provides the complete set of
  JsRender APIs and features, together with integration
  with NodeJS view-engines such as Express and Hapi, APIs
  for loading templates from the file system, etc.
  The file system APIs now use the syntax tmpl="./file/path.html".

  It also includes a built-in Browserify transform (see "Browserify
  Support: below).

  (Note: JsRender and JsViews will soon be published to NPM).

- The behavior when loading multiple instances of JsRender or
  JsViews files has been changed: When loading a new instance,
  the previous instance $.views, $.templates, etc. is no longer
  overwritten. So a component using JsRender or JsViews will not,
  when loaded, cause another already loaded component also using
  JsViews/JsRender to fail (except for collisions arising in the
  unlikely case where both happen to use the same
  template/converter/helper name).

  As part of this modified behavior, the noConflict support
  for JsRender had been removed.

NEW FEATURES

- observeAll() for cyclic objects is now supported for the
  vast majority of cases.
  See #304

- Improved support for data-linking to data- attributes:
  <elem data-link="data-foo{:expr}" ...>.
  After data-linking, the value of the data-foo attribute
  will be expr.toString(), but $.data(element, "foo") and
  $(element).data("foo") will actually return the value of
  expr, even if of type object.
  See #306

- Browserify Support:
  JsRender on Node.js provides a built-in Browserify
  transform - jsrender.tmplify, for including compiled JsRender
  templates from the server, as part of the client javascript
  bundle generated by Browserify.

  Usage example:

  var $jsr = require('jsrender');

  browserify(...) ... .transform($jsr.tmplify) ...
  See also http://www.jsviews.com/test/unit-tests-browserify.html

- Initial work for deployment to Bower and NPM. See
  #254
  BorisMoore/jsrender#225

Bug Fixes:

- BorisMoore/jsrender#263
  BorisMoore/jsrender#264
  Caching of template on script elements. (Unit tests
  added)

- #304
  ObserveAll on cyclic objects

- #306
  'data-xxxx' attribute using data-link

- #307
  #312
  • Loading branch information
BorisMoore committed Aug 18, 2015
1 parent 30f33ec commit 7b4a375
Show file tree
Hide file tree
Showing 44 changed files with 5,133 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/.*
node_modules
bower_components
test/browserify/bundles/*.js
*.config
Scripts
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**/.*

/test/browserify/bundles/*.js
*.config
gulpfile.js

/Scripts
/node_modules
/bower_components
/demos
/test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## JsViews: Next-generation MVVM and MVP framework - bringing templates to life
_The power of MVVM, the flexibility of JavaScript, the speed and ease of JsRender templates_<br/>
_The power of MVVM, the flexibility of JavaScript, the speed and ease of JsRender templates and jQuery_<br/>

**JsViews** builds on top of **[JsRender](http://www.jsviews.com/#jsrender)** templates, and adds data-binding and **[observable data](http://www.jsviews.com/#jsobservable)**, to provide
a fully-fledged MVVM platform for easily creating interactive data-driven single page apps and websites.
**JsViews** builds on top of **[JsRender](http://www.jsviews.com/#jsrender)** templates, and adds data-binding and **[observable data](http://www.jsviews.com/#jsobservable)**, to provide a fully-fledged MVVM platform for easily creating interactive data-driven single
page apps and websites.

**JSRender** and **JsViews** together provide the next-generation implementation of both _JQuery Templates_, and _JQuery Data Link_ - and supersede those libraries.

Expand All @@ -17,4 +17,4 @@ See also the _[JsRender](https://github.com/BorisMoore/jsrender)_ repository on
In addition to the demos at [www.jsviews.com/#samples](http://www.jsviews.com/#samples), see also the [demos](https://github.com/BorisMoore/jsviews/tree/master/demos) folder of this GitHub repository - available [here](http://borismoore.github.io/jsviews/demos/index.html) as live samples.

<h3>Current Status</h3>
JsViews is now an alpha release, which will be declared beta as soon as API documentation is complete on the [www.jsviews.com](http://www.jsviews.com) website, and then move to V1.0.
JsViews is now a beta candidate release, which will be declared beta as soon as API documentation is complete on the [www.jsviews.com](http://www.jsviews.com) website, and then move to V1.0.
47 changes: 47 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "jsviews",
"main": "jsviews.js",
"homepage": "http://www.jsviews.com/#jsviews",
"authors": [
{
"name": "Boris Moore",
"email": "[email protected]",
"homepage": "https://github.com/borismoore"
}
],
"description": "Next-generation MVVM and MVP framework - built on top of JsRender templates. Bringing templates to life...",
"moduleType": [
"amd",
"globals",
"node"
],
"repository": {
"type": "git",
"url": "git://github.com/borismoore/jsviews.git"
},
"keywords": [
"jsviews",
"jsrender",
"jquery",
"mvvm",
"mvp",
"spa",
"browserify",
"templates",
"template"
],
"license": "MIT",
"dependencies": {
"jquery": ">=1.8"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"demos",
"*.md",
"gulpfile.js",
"package.json"
]
}
26 changes: 26 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var gulp = require('gulp'),
browserify = require('browserify'),
fs = require('fs');

//================================= BUNDLE - Run Browserify - create client bundles for test cases =================================//
// See https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-with-globs.md

// Task to create Browserify client-side bundle scripts for Browserify test cases.
gulp.task('bundle', function() {
var $jsr = require('jsrender');
var gs = require('glob-stream');

return gs.create('./test/browserify/*-unit-tests.js')
.on('data', function(file) {
// file has path, base, and cwd attrs
var fileName = file.path.slice(file.base.length, -14);
browserify(file.path, {debug:true})
.transform($jsr.tmplify)
.bundle()
.pipe(fs.createWriteStream('./test/browserify/bundles/' + fileName + "-bundle.js"))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
});
2 changes: 1 addition & 1 deletion jquery.observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ if (!$.observe) {
// NOTE - WE DO NOT support ObserveAll on data with cyclic graphs which include DUPLICATE REFERENCES TO ARRAY PROPERTIES - such as data.children = data.descendants = []
}
if (!objMap) {
window.map = objMap = {un: unobserve}; // Map object to register observed objects for this observeAll
objMap = {un: unobserve}; // Map object to register observed objects for this observeAll
}

if (cb) {
Expand Down
2 changes: 1 addition & 1 deletion jquery.observable.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.observable.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 7b4a375

Please sign in to comment.