1. Start
Scrat the author said to get a very bunker example, sure enough to get out, if you want to learn and use Scrat, can start from the official example, is simply too convenient .
2.Scrat Example
Directory
Component_modules: Common Components
Components : System-Level components
Server: some services, no tube
Views : scrat.js,index.html and other Scrat framework content
Component.json: Scrat Eco-component configuration file
fis-conf.js: FIS configuration file
Package.json: node configuration file
System-level components are separated into a single folder, including Js,css,handlebars ( what is handlebars?). Handlebars is a template that is built as a TPL attribute in a JS file, and then dynamically reads the data as it is rendered, eventually becoming the HTML we see.
Rendering of the skeleton
The code in Site.js and Site.handlebars is implemented as follows
Menu.render,footer.render, a familiar rhythm, that's what the Express view engine says.
The composition of the skeleton
Open Scrat/components/site/site.handlebars, the system is composed of three parts of Site-menu,site-content,site-footer.
<div class= "Site Transition-all" > <div class= "Site-menu transition-all" id= "Site-menu" ></div> <div class= "Site-content transition-all" > <div id= "site-views" class= "Site-views" > {{# Each views}} <div class= "Site-view" data-page= "{{@key}}" ></div> {{/each}} </div> </div> <div id= "Site-footer" class= "Site-footer transition-all" ></div></div>
Require
Require refers to files that are dependent
Each and extend are mapped by the name field of the Component.json under Scrat-team-each,scrat-team-extend.
{ ' name ': ' Each ', ' repo ': ' Scrat-team/each ', ' description ': ' A ForEach shim for both array and object ', "Version": "0.1.0", "keywords": ["Each", "ForEach"], "Scripts": ["Index.js"], "dependencies": { " Scrat-team/type ":" 0.1.0 " }, " license ":" MIT "}
3. End
Next combined with the official website of the examples and instructions, already have to be their own. NET front-end project is refactored into the east wind of the Scrat project, then there may be pits, first try it.
Single page HTML technology flaw: May cause your website to be unable to crawl, I think this is also why use blink technology is Twitter, Facebook, these sites probably don't want to be crawled by Google content and sell ads.
Nodejs in Visual Studio Code 13. Building a single-page application Scrat sample Digging