Asm Dom Boilerplate Save

A simple boilerplate to start using asm-dom without configuration.

Project README

asm-dom-boilerplate

A simple boilerplate to start using asm-dom without configuration. This includes:

  • asm-dom
  • CPX support: JSX like syntax in C++
  • parcel-bundler (npm i --save-dev [email protected])
  • autoprefixer

The boilerplate automatically compiles C++ code to WebAssembly and asm.js, the client will dinamically require the first if supported, the second otherwise.

Prerequisites

Please make sure to have emcc set as an environment variable and the lastest version of node to make parcel work. So, to validate the installation, please run the following commands:

node -v
npm -v
make -v
emcc -v
java -version

Getting started

Clone and install dependencies:

git clone https://github.com/mbasso/asm-dom-boilerplate.git
cd asm-dom-boilerplate
npm install # or make install

# if you are using windows, you have to make a little change to the Makefile in the root of the project, just open it and follow the instructions at the top

npm start # or make start

Then open http://localhost:1234 to see the example app. You can now edit index.cpp and rerun npm start to recompile and see the changes.

Building for Production

# just run:
make

This will compile your C++ and copy your index.html to the dist folder which you can deploy.

Makefile

By default the boilerplate preprocess the .cpp files in the src folder with gccx and automatically includes them when compiling. If you want to include external dependencies or add some C flags, you can modify the Makefile in the root of the project.

CSS

Parcel uses PostCSS plugins to manage CSS assets. The boilerplate includes autoprefixer for vendor prefixing, you can find and modify the PostCSS setup in .postcssrc.

Authors

Matteo Basso

Copyright (c) 2018, Matteo Basso.

asm-dom-boilerplate source code is licensed under the MIT License.

Open Source Agenda is not affiliated with "Asm Dom Boilerplate" Project. README Source: mbasso/asm-dom-boilerplate
Stars
52
Open Issues
3
Last Commit
10 months ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating