A simple component using soy templates and Browserify.
Since this example is a soy component, it needs to use Metal.js's custom logic for compiling soy templates so they can be integrated with the appropriate Component class. This example uses metal-cli to compile the templates before bundling the code via Browserify.
The Browserify command is included in the build
script, so take a look at package.json to check it out. Note that we're using babelify to compile the ES6 code, and using babel-preset-metal with it.
The code has lots of comments explaining how everything works.
-
Install NodeJS >= v0.12.0, if you don't have it yet.
-
Install local dependencies:
npm install
- Build the code:
npm run build
- Open the demo at demos/index.html on your browser.