A cross-platform application for viewing Enyo 2.0 samples from all its various libraries.
For the most recent released version, see the Enyo JS website. The latest nightly build is also available at http://nightly.enyojs.com/latest/sampler/debug.html.
The app allows navigation through each library's samples. Each sample is designed to be usable across all form factors, as a kind that can be rendered within the Sampler app, as well as standalone via the accompanying .html file.
You can inspect the current sample through the console via window.sample.
Since the app AJAX's in the JavaScript and CSS source files for the viewer, a few simple conventions must be followed to add new samples to the app:
- The
assets/manifest.jsonfile defines the left-hand navigation hierarchy of the app:- An entry with a
samplesarray defines a nested menu. - An entry with a
pathstring defines a sample at the path's location (omit the.jsfrom the filename) - Optionally, a
cssstring defines the base filename of a shared CSS file instead of defaulting to use a CSS file with the same name as the .js file.
- An entry with a
- A sample must consist of one .js file containing a top-level kind of the same name as the file. For example
ButtonSample.jsshould contain (at least) aButtonSamplekind, which is the kind rendered into the right-hand panel of the app. - By default, samples should define their css in a file with the same name as the kind (for example,
ButtonSample.css). However, by specifying the optionalcssparameter in the manifest, more than one smaple may share the same CSS file. - Using this scheme, more than one sample .js file may be situated in the same folder, where they all share a sample.css file.
- When deploying the app, change the
sourcePathvariable inassets/manifest.jsonto point to a root directory containing un-minified versions of theenyoandlibdirectories (containing at least the samples).