mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Grunt updated with concat and jshint
Also added initial platform detection thing.
This commit is contained in:
43
Gruntfile.js
43
Gruntfile.js
@ -1,3 +1,44 @@
|
|||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
}
|
grunt.initConfig({
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
|
||||||
|
concat: {
|
||||||
|
options: {
|
||||||
|
separator: ';'
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: [
|
||||||
|
'js/ionic.js',
|
||||||
|
'js/platform.js',
|
||||||
|
'js/utils.js',
|
||||||
|
'js/events.js',
|
||||||
|
'js/gestures.js',
|
||||||
|
'js/viewController.js',
|
||||||
|
'js/views/**/*.js',
|
||||||
|
'js/controllers/**/*.js'
|
||||||
|
],
|
||||||
|
dest: 'dist/<%= pkg.name %>.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jshint: {
|
||||||
|
files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'],
|
||||||
|
options: {
|
||||||
|
// options here to override JSHint defaults
|
||||||
|
globals: {
|
||||||
|
jQuery: true,
|
||||||
|
console: true,
|
||||||
|
module: true,
|
||||||
|
document: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
|
||||||
|
grunt.registerTask('default', ['jshint', 'concat']);
|
||||||
|
};
|
||||||
|
|||||||
@ -5,14 +5,16 @@ function initalize() {
|
|||||||
document.removeEventListener( "DOMContentLoaded", initalize, false );
|
document.removeEventListener( "DOMContentLoaded", initalize, false );
|
||||||
window.removeEventListener( "load", initalize, false );
|
window.removeEventListener( "load", initalize, false );
|
||||||
|
|
||||||
|
/*
|
||||||
// trigger that the DOM is ready
|
// trigger that the DOM is ready
|
||||||
ion.trigger("ready");
|
ionic.trigger("ready");
|
||||||
|
|
||||||
// trigger that the start page is in view
|
// trigger that the start page is in view
|
||||||
ion.trigger("pageview");
|
ionic.trigger("pageview");
|
||||||
|
|
||||||
// trigger that the webapp has been initalized
|
// trigger that the webapp has been initalized
|
||||||
ion.trigger("initalized");
|
ionic.trigger("initalized");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the DOM is ready, initalize the webapp
|
// When the DOM is ready, initalize the webapp
|
||||||
|
|||||||
26
js/platform.js
Normal file
26
js/platform.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
(function(ionic) {
|
||||||
|
|
||||||
|
ionic.Platform = {
|
||||||
|
PLATFORM_CLASS_MAP: {
|
||||||
|
'ios7': 'ios7'
|
||||||
|
},
|
||||||
|
annotate: function() {
|
||||||
|
var platform = this._checkPlatforms();
|
||||||
|
platform && document.body.classList.add('platform-' + platform);
|
||||||
|
},
|
||||||
|
_checkPlatforms: function() {
|
||||||
|
if(this.isIOS7()) {
|
||||||
|
return 'ios7';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isIOS7: function() {
|
||||||
|
if(!window.device) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return parseFloat(window.device.version) >= 7.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ionic.Platform.annotate();
|
||||||
|
|
||||||
|
})(ionic = window.ionic || {});
|
||||||
@ -3,7 +3,7 @@
|
|||||||
this.init();
|
this.init();
|
||||||
};
|
};
|
||||||
|
|
||||||
ion.ViewController.prototype = {
|
ionic.ViewController.prototype = {
|
||||||
// Initialize this view controller
|
// Initialize this view controller
|
||||||
init: function() {
|
init: function() {
|
||||||
},
|
},
|
||||||
|
|||||||
10
package.json
10
package.json
@ -3,13 +3,15 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.01",
|
"version": "0.0.01",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.0",
|
"grunt": "~0.4.1",
|
||||||
"grunt-contrib-watch": "~0.1.0",
|
"grunt-contrib-watch": "~0.5.3",
|
||||||
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
|
"grunt-contrib-uglify": "~0.2.4",
|
||||||
|
"grunt-contrib-jshint": "~0.6.4"
|
||||||
},
|
},
|
||||||
"licenses": [
|
"licenses": [
|
||||||
{
|
{
|
||||||
"type": "MIT",
|
"type": "MIT"
|
||||||
"url": "https://github.com/zurb/foundation/blob/master/LICENSE"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user