A simple boilerplate to start using asm-dom without configuration. This includes:
asm-dom
CPX support: JSX like syntax in C++
parcel-bundler
autoprefixer
The boilerplate automatically compiles C++ code to WebAssembly and asm.js, the client will dinamically require the first if supported, the second otherwise.
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
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.
# just run:
make
This will compile your C++ and copy your index.html
to the dist
folder which you can deploy.
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.
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
.
Matteo Basso
Copyright (c) 2018, Matteo Basso.
asm-dom-boilerplate source code is licensed under the MIT License.