@dosgato/templating
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -0,1 +1,18 @@ | ||
export interface CSSBlock { | ||
css?: string; | ||
path?: string; | ||
version?: string; | ||
defer?: boolean; | ||
} | ||
export interface JSBlock { | ||
js?: string; | ||
path?: string; | ||
version?: string; | ||
defer?: boolean; | ||
} | ||
export interface FileDeclaration { | ||
path: string; | ||
version?: string; | ||
mime: string; | ||
} | ||
/** | ||
@@ -23,18 +40,19 @@ * This class is a parent class for Component, but it can also be used as a standalone | ||
* For convenience you can either provide the `css` property with the CSS as a string, or the | ||
* `path` property with the full server path to a CSS file (node's __dirname function will | ||
* `path` property with the full server path (NOT URL) to a CSS file (node's __dirname function will | ||
* help you determine it). You MUST provide one or the other. | ||
* | ||
* You may also set `defer` to true if a css block is not needed for the initial render of | ||
* the page. For instance, if your component has a modal that the user can trigger, you can | ||
* defer the CSS for that modal since it will not be needed until the page has gone interactive | ||
* and the user has clicked something. | ||
*/ | ||
static cssBlocks: Map<string, { | ||
css?: string; | ||
path?: string; | ||
version?: string; | ||
}>; | ||
static cssBlocks: Map<string, CSSBlock>; | ||
/** | ||
* Same as cssBlocks() but for javascript. | ||
* | ||
* In this case `defer` is much more useful, as most javascript is interactive and could run | ||
* after the page renders. Any code that adds event observers or the like should be marked with | ||
* defer to improve the initial render time. | ||
*/ | ||
static jsBlocks: Map<string, { | ||
js?: string; | ||
path?: string; | ||
version?: string; | ||
}>; | ||
static jsBlocks: Map<string, JSBlock>; | ||
/** | ||
@@ -62,7 +80,3 @@ * If your template needs to serve any files, like fonts or images, you can provide | ||
*/ | ||
static files: Map<string, { | ||
path: string; | ||
version?: string; | ||
mime: string; | ||
}>; | ||
static files: Map<string, FileDeclaration>; | ||
/** | ||
@@ -69,0 +83,0 @@ * Template code will need to generate HTML and CSS that points at the static files |
@@ -30,4 +30,9 @@ "use strict"; | ||
* For convenience you can either provide the `css` property with the CSS as a string, or the | ||
* `path` property with the full server path to a CSS file (node's __dirname function will | ||
* `path` property with the full server path (NOT URL) to a CSS file (node's __dirname function will | ||
* help you determine it). You MUST provide one or the other. | ||
* | ||
* You may also set `defer` to true if a css block is not needed for the initial render of | ||
* the page. For instance, if your component has a modal that the user can trigger, you can | ||
* defer the CSS for that modal since it will not be needed until the page has gone interactive | ||
* and the user has clicked something. | ||
*/ | ||
@@ -37,2 +42,6 @@ ResourceProvider.cssBlocks = new Map(); | ||
* Same as cssBlocks() but for javascript. | ||
* | ||
* In this case `defer` is much more useful, as most javascript is interactive and could run | ||
* after the page renders. Any code that adds event observers or the like should be marked with | ||
* defer to improve the initial render time. | ||
*/ | ||
@@ -39,0 +48,0 @@ ResourceProvider.jsBlocks = new Map(); |
{ | ||
"name": "@dosgato/templating", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A library to support building templates for dosgato CMS.", | ||
@@ -5,0 +5,0 @@ "exports": { |
32364
629