| pup-tent.js | |
| Functions | |
| AbstractFS | Synchronous cross-platform filesystem abstraction for a few common operations. |
| environment | Return a string representation og the current running environment. |
| exists_p | Whether or not a path exists. |
| file_p | Returns whether or not a path is a file. |
| read_file | Read a file, returning it as a string. |
| list_directory | Return a list of the files in a directory (names relative to the directory) as strings. |
| require(‘pup-tent’) | Creates an instance of the Pup Tent femto-framework. |
| use_cache_p | By default, Pup Tent uses a cache of files read from the filesystem during the initial scan. |
| get | Get a file from the cache by key; null otherwise. |
| cached_list | Returns a list of the cached files. |
| apply | Run a template with the given arguments. |
| set_common | Add variables and libraries to special variables for all calls to render. |
| render | Render with special variables. |
function AbstractFS()
Synchronous cross-platform filesystem abstraction for a few common operations. Not meant to a be full-blown fix for these issues (http://www.gigamonkeys.com
Currently supports Node.js and RingoJS. Will hopefully be unnecessary when CommonJS and everybody get it together: http://wiki.commonjs.org/wiki/Filesystem
n/a
An instance of the AbstractFS abstraction.
Creates an instance of the Pup Tent femto-framework.
| search_path_list | list of directories to search for static files (e.g. [‘static’, ‘js’, ‘css’, ‘templates’]) |
| filename_list | [optional] list of static files (e.g. [‘Login.js’, ‘login_content.tmpl’]) |
An instance of the Pup Tent femto-framework.
use_cache_p: function( yes_no )
By default, Pup Tent uses a cache of files read from the filesystem during the initial scan. However, to enable rapid development of browser JS and sites, this can be turned off, with files being re-read off the filesystem.
Note that new or deleted files would still require a restart.
| yes_no | [optional] change the state of cache use (default: true) |
boolean
set_common: function( stack_name, thing )
Add variables and libraries to special variables for all calls to render.
| stack_name | the name of the stact to add to (list above) |
| thing | variable structure; either a string for *_libs or {‘name’: name, ‘value’: value} for js_vars |
return thing or null
render: function( tmpl_name, tmpl_args, frame_tmpl_name )
Render with special variables. Also wrapper for the usual inner/outer pattern.
| tmpl_name | content template name (in path) |
| tmpl_args | variable arguments |
| frame_tmpl_name | [optional] using variable [pup_tent_content] embed content_tmpl_name |
string
Synchronous cross-platform filesystem abstraction for a few common operations.
function AbstractFS()
Return a string representation og the current running environment.
anchor.environment = function()
Whether or not a path exists.
anchor.exists_p = function( path )
Returns whether or not a path is a file.
anchor.file_p = function( path )
Read a file, returning it as a string.
anchor.read_file = function( path )
Return a list of the files in a directory (names relative to the directory) as strings.
anchor.list_directory = function( path )
By default, Pup Tent uses a cache of files read from the filesystem during the initial scan.
use_cache_p: function( yes_no )
Get a file from the cache by key; null otherwise.
get: function( key )
Returns a list of the cached files.
cached_list: function()
Run a template with the given arguments.
apply: function( tmpl_name, tmpl_args )
Add variables and libraries to special variables for all calls to render.
set_common: function( stack_name, thing )
Render with special variables.
render: function( tmpl_name, tmpl_args, frame_tmpl_name )