A Yeoman generator for Ionic Projects with Gulp
This is a yeoman generator for my Ionic Gulp Seed, a minimal Ionic app template. It sets up everything to get you started with Gulp and Ionic in no time.
- Gulp jobs for development, building, emulating and running your app
- Compiles and concatenates your Sass
- Local development server with live reload, even inside ios emulator
- Automatically inject all your JS sources into
index.html - Auto min-safe all Angular DI through
ng-annotate, no need to use weird bracket notation - Comes already with ng-cordova and lodash included
- generate icon font from svg files
- Blazing fast
You should have Yeoman installed globally
npm install -g yoTo install generator-ionic-gulp from npm, run:
npm install -g generator-ionic-gulpFinally, initiate the generator:
yo ionic-gulpafter installation, just run:
gulpto start up the build job and file watchers.
In order to compile Sass, you need to have ruby and the sass ruby gem installed: gem install sass.
This doc assumes you have gulp globally installed (npm install -g gulp).
If you do not have / want gulp globally installed, you can run npm run gulp instead.
By running just gulp, we start our development build process, consisting of:
- compiling, concatenating, auto-prefixing of all
.scssfiles required byapp/styles/main.scss - creating
vendor.jsfile from external sources defined in./vendor.json - linting all
*.jsfilesapp/scripts, see.jshintrcfor ruleset - automatically inject sources into
index.htmlso we don't have to add / remove sources manually - build everything into
.tmpfolder (also gitignored) - start local development server and serve from
.tmp - start watchers to automatically lint javascript source files, compile scss and reload browser on changes
By running just gulp --build or short gulp -b, we start gulp in build mode
- concat all
.jssources into singleapp.jsfile - version
main.cssandapp.js - build everything into
www - remove debugs messages such as
console.logoralertwith passing--release
By running gulp -e <platform>, we can run our app in the simulator
- can be either
iosorandroid, defaults toios - make sure to have iOS Simulator installed in XCode, as well as
ios-simpackage globally installed (npm install -g ios-sim) - for Android, Ripple or Genymotion seem to be the emulators of choice
- It will run the
gulp --buildbefore, so we have a fresh version to test - In iOS, it will livereload any code changes in iOS simulator
By running gulp select you will se a prompt where you can choose which ios device to emulate. This works only when you have the gulp -e task running in one terminal window and run gulp select in another terminal window.
Run gulp ripple to open your app in a browser using ripple. This is useful for emuating a bunch of different Android devices and settings, such as geolocation, battery status, globalization and more. Note that ripple is still in beta and will show weird debug messages from time to time.
By running gulp -r <platform>, we can run our app on a connected device
- can be either
iosorandroid, defaults toios - It will run the
gulp --buildbefore, so we have a fresh version to test
Replace splash.png and icon.png inside /resources. Then run ionic resources. If you only want to regenerate icons or splashs, you can run gulp icon or gulp splash shorthand.
MIT
