-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Install node.js and make sure it is available on your command line. (You can type 'npm' to validate. If it doesn't work, you may need to adjust your path to point to the node directory.)
Yeoman is a scaffolding system that makes it easy to get up and running with a functional site. The OneJS yeoman generator will generate for you a sample project, which you can use to get your view up and running fast.
npm install -g yo
npm install -g generator-onejs
Make a directory, and nav into it:
mkdir TestView
cd TestView
Generate a project by running the yeoman template:
yo onejs
It will prompt you for a classname to name your view, defaulting to the directory name you used. Use TestView for now.
Once the project has been generated, build it and open the index.html:
gulp
open index.html
The generator builds an example project you can start growing into a new site or reusable view.
The /src/TestView directory contains 4 files:
- TestView.html - the template for the view. See the templating syntax documentation for information on editing templates.
- TestView.less - the LESS css file for the view.
- TestViewBase.ts - the base class for the view. This is optional and can be deleted (delete the js-baseType attribute in the template if you do.)
- TestViewModel.ts - the default view model to be used for the view. This is optional and can be deleted (delete the js-model attribute in the template if you do.)
You can edit the template, run gulp again, and refresh the browser to see changes.