This is a project template for developing Soundworks applications.
The template also includes comprehensive comments in the source files.
To start the development of a new Soundworks application, we recommend the following sequence of commands:
$ git clone https://github.com/collective-soundworks/soundworks-template.git my-soundworks-application
$ cd my-soundworks-application
$ rm -Rf .git
$ npm install
$ npm run watchIf you succeeded to execute all commands without errors, you can start connecting clients - on a mobile phone or a browser simulating a mobile user agent and touch events - to the server.
The template includes a set of scripts to support the development of an application.
The scripts can be invoked through the npm run command:
transpile- creates an executable application from the ES2015 (ES6) sourcesstart- starts the application (i.e. its server).watch- starts the server and watches the file system to do the necessary operations while developing
$ npm run transpile
$ npm run start
$ npm run watchIn detail, the transpile script implies the following operations:
- transpile javascript source files from ES2015 to ES5
- rebundle (i.e. browserify) the client Javascript (ES5) sources
- recreate the CSS files from their SASS sources
The following operations may be performed by the watch script depending on the modification of source files:
- recreate a CSS file when a corresponding SASS file in the
sassdirectory is modified - re-transpile a modified server source file in the
src/serverdirectory - re-transpile and browserify a modified client source file in the
src/clientdirectory - re-transpile a modified source file used on both, client and server, in the
src/commondirectory
The template consists of the following files and directories you should know about:
bin- the Node.js scripts (no need to touch these)public- everything the clients need to run the applicationfonts- fonts used by the application template (this is your directory)sounds- sounds used by the application template (this is your directory)js- transpiled javascript files (do not touch)css- CSS stylesheets automatically created from SASS sources (do not touch)- . . . add here the assets (images, movies, etc.) used by the clients of your application
sass- SASS stylesheet sourcesmain.scss- includes all other SASS files in the directory (the provided files are described in comments)- . . . add your styles here (as SASS files) and include them into the
main.scssfile
src- javascript (ES2015) sources (this is all yours)client- sources of the application's client side (contains one directory per client type)player- sources of the player clientindex.js- main file of the player client- . . . files imported by the
index.jsmain file
server- sources of the application's server sideindex.js- server side main file (for all client types)- . . . files imported by the
index.jsserver side main file
html- template files to generate the application'sindex.htmlfiles (no need to touch)package.json- NPM package file (modify so that the description and dependencies match your application)README.md- this file (that you should replace by a file that informs about your application)
This structure is required by the Soundworks framework and the helper scripts.
The files that are part of the application's implementation (i.e. especially the files in the src directories) contain comprehensive explanatory comments.