0.0.11 • Published 9 years ago

done-server-side-render v0.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Build Status npm version

done-server-side-render

Server-side rendering for users of StealJS and CanJS.

Usage

var render = require("done-server-side-render")({
  config: __dirname + "/public/package.json!npm",
  main: "index.stache!"
});

render("/orders").then(function(html){
  // Do something with `html`
});

API

asset-register

A module used to register assets:

var register = require("asset-register");

register("module/name", "css", function(){
	return HTMLElement;
});

register(moduleName, type, assetMaker)

Register takes the moduleName to register, a type associated with it, and a function that when called returns an HTMLElement.

register(type, assetMaker)

If registering an asset not associated with a particular module, supply only the type and a function that when called returns an HTMLElement.

asset (helper)

When rendering in Node, a special asset helper is included. This is used to append assets within your template:

<html>
	<head>
		{{asset "css"}}
	</head>
	<body>
		<can-import from="routes"/>

		...
	</body>
</html>

In this example, all CSS (either <style> or <link> elements depending on whether you are in development or production.

{{asset type}}

Specify the type to insert. Assets can be registered with asset-register (docs above). Types provided natively by JavaScriptMVC:

  • css: Inserts a <style> or <link>
  • inline-cache: If using the can.AppMap will insert data fetched as part of the page lifecycle.

License

MIT

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.3

9 years ago