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. Currently using Ionic 1.3.0 and Angular 1.5.3.
index.html
ng-annotate
, no need to use weird bracket notationYou should have Yeoman installed globally
npm install -g yo
To install generator-ionic-gulp from npm, run:
npm install -g generator-ionic-gulp
Finally, initiate the generator:
yo ionic-gulp
after installation, just run:
gulp
to start up the build job and file watchers.
In order to compile Sass, you need to have ruby and the sass ruby gem installed:
Now using https://github.com/sass/node-sass insteadgem 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:
.scss
files required by app/styles/main.scss
vendor.js
file from ./vendor.json
bower.json
using wiredep
*.js
files app/scripts
(or src/ if using browserify), see .jshintrc
for rulesetindex.html
so we don't have to add / remove sources manually.tmp
folder (also gitignored).tmp
If you opted for browserify support all your sources will be kept in app/src instead of app/scripts. Please check app/src/app.js to see how modules can be added to your angular module. Browserify will automatically bundle only the code you require and you can require any module you installed with npm (provided they can be used in a webbrowser)
If you opted for browserify support you have sourcemaps available in development mode. The script bundle and map file will be written in scripts/ and are .gitignored. The only other file in the scripts/ folder is the configuration.js file for your constants and other settings.
NOTE: Beware that if you bundle (and uglify) angular modules you need to use the pattern where you provide an array with named parameters. See code below for an example of the difference.
// When not bundling you can do this
.run( function( $ionicPlatform ) { ... } )
// If you bundle you need to use the following pattern:
.run( [ '$ionicPlatform', function( $ionicPlatform ) { ... } ] )
// You can keep adding parameters like so:
.run( [ '$ionicPlatform', '$q', '$http', function( $ionicPlatform, $q, $http ) { ... } ] )
See the browserify website for what you can and cannot do with browserify: http://browserify.org/
If you need to add transpiling to browserify the location to do so has been marked in the gulpfile.js
By running just gulp --build
or short gulp -b
, we start gulp in build mode
.js
sources into single app.js
filemain.css
and app.js
www
console.log
or alert
with passing --release
By running gulp -e <platform>
, we can run our app in the simulator
ios-sim
package globally installed (npm install -g ios-sim
)gulp --build
before, so we have a fresh version to testBy running gulp select
you will see 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
gulp --build
before, so we have a fresh version to testReplace 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.
Just override any Ionic variables in app/styles/ionic-styles.scss
.
vendor.json
dependency, use wiredep
instead, close #21app/styles/ionic-styles.scss
thanks @superthing001ionic.bundle.js
to reduce bower dependencies in vendor.json
MIT