view.js
The simple, extensible view solution. For both client and server. Web-Component ready.
// Definevar MyView = view; // Createvar view = ; view; viewelinnerHTML; //=> 'hello world';
Plugins
View.js aims to be the thin base class on which each UI component in you application can build on top of. The library is designed to be as light as possible; encouraging additional funcitonality to be bolted on, in the form of plugins.
var MyView = oneview;
Web-Component Ready
View.js has been designed around the web-components Custom-Elements spec. The viewjs-custom-element plugin give you the ability to upgrade any defined view to a custom-element.
var MyView = view;
Views can then be instantiated in a variety of ways,
var view2 = ;var view1 = document;
or as HTML,
Encapsulated styling
The viewjs-css plugin provides an encapsulated styling solution based around scoped stylesheets. This means that stylesheets sit alongside markup, and only get parsed when the view component lands in the DOM.
// Attach the pluginview; var MyView = view; var myview = ; myview;myviewinnerHTML; //=> <style scoped>h1 { color: red; }</style><h1>hello world</h1>
Writing CSS inside a JS file isn't the nicest of workflows, so it is advisable to use Browserify or Require.js to include the required CSS text string at build time.
var MyView = view;
or
;
This makes our UI components fully transportable. A single built JS file contains everything we need to render a fully working view component!