requirejs-nodewebkit-template-project
requirejs-nodewebkit-template-project copied to clipboard
A template project for building node-webkit apps in require.js style.
requirejs-nodewebkit-template-project
A template project for building node-webkit apps in require.js style. Provides complete integration for testing, building and releasing apps.
The goal of this project is to provide an entry point for developing your own apps with requirejs and node-webkit.
Extracted from physiogame.
Features
- example app, includes libs lodash, loglevel and polljs (shim test).
- folder structure and base files
- requirejs configs for building, testing and development
- grunt tasks
- build via r.js (almond or requirejs)
- test via mocha and chai in phantomjs
- automate release builds for win/mac/linux with grunt-node-webkit-builder
- automate copying assets, minifying css, uglyfing js, ...
Directory layout
assets
all your assets, will be copied automatically to build with grunt task
build
(created via grunt build task) the optimized build app
build-templates
files that are used during the grunt build task
node_modules
(npm) 3rd party libs
release
(created via grunt release task) binary app for win/mac/linux
scripts
startup scripts for requirejs, r.js build config and testrunner
src/integration
YOUR app integration tests
src/libs
YOUR app source files
src/spec
YOUR app spec tests
src/vendor
(bower) 3rd party libs
Important files
app.css
: your main css file, will be minified into build/app.min.css
app.js
and build-templates/app.js
: development startup script and productive startup script, productive will be minified into build/app.min.js
bower.json
: dependencies from bower package repository (will be installed into src/vendor/
)
Gruntfile.js
: all grunt build and release tasks
index.html
and build-templates/index.html
: main html file with app.js or app.min.js in body
package.json
: dependencies from npm package repository (will be installed into node_modules
)
testrunner.html
: main file to start spec and integration tests (phantomjs compatible)
scripts/build-almond.js
: r.js build file (uses almond, smaller footprint, better compatibility with node-webkit)
scripts/build-requirejs.js
: r.js build file (uses requirejs, might cause problems with globale require of node-webkit and requirejs)
scripts/main.js
: main requirejs config of application and start entry point
scripts/testrunner.js
: main testrunner js file, starts a test cycle
Prerequisites
- node.js and npm must be installed!
- bower should be installed globally via npm!
- (testing only) download phantomjs bin and make it available in your PATH environment variable.
Installation
`git clone https://github.com/majodev/requirejs-nodewebkit-template-project.git`cd requirejs-nodewebkit-template-project
npm install -d
bower update
Fire up your http-server in project root, e.g. simple http-server for node is straightforward: npm install http-server -g
.
http-server -c-1
Go to localhost:8080
and enjoy
Building
`grunt build`The grunt task grunt build
takes care of all js/css minifying and assets/templates copying to the folder build
.
Fire up your http-server in project root, e.g. simple http-server for node is straightforward: npm install http-server -g
.
http-server -c-1
Go to localhost:8080/build
and enjoy
Releasing
`grunt release`Builds apps for win/mac/linux to the folder release
.
That's it! Easy huh?!
Testing
needs phantomjs bin in PATH environment variable!grunt
or
grunt watch
for continuous testing
Copyright and Licenses
MIT licenseSee LICENSE.md for further information
(c) 2013 Mario Ranftl (majodev).