jQuery Mobile package definition. Draft. Currently it misses the minified files, which could be implemented analogous to https://github.com/jquery/download.jqueryui.com/blob/fix-178-n-255/lib/package-1-12.js#L265
Last active
August 29, 2015 14:15
-
-
Save rxaviers/d60e586ccae7b3b6ac67 to your computer and use it in GitHub Desktop.
jQuery Mobile package definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var files, pkg, | |
fs = require( "js" ), | |
glob = require( "glob" ), | |
MobilePackage = require( "mobile-package" ), | |
Packager = require( "node-packager" ); | |
files = glob.sync( "mobile-repo/**)", { nodir: true } ).reduce(function( files, filepath ) { | |
files[ filepath ] = fs.readFileSync( filepath ); | |
return files; | |
}, {} ); | |
pkg = new Packager( files, MobilePackage, { components: components }); | |
pkg.toZip( "mobile.zip", { | |
basedir: "jquery.mobile.custom" | |
}, function( error ) { | |
if ( error ) { | |
return callback( error ); | |
} | |
callback(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsBundleIntro, jsBundleOutro, | |
amdBuilder = require( "builder-amd" ), | |
extend = require( "util" )._extend, | |
jqueryCssBuilder = require( "builder-jquery-css" ), | |
ThemeRoller = require( "jquery-ui-themeroller" ); | |
jsBundleIntro = "(function( factory ) {\n" + | |
" if ( typeof define === \"function\" && define.amd ) {\n" + | |
"\n" + | |
" // AMD. Register as an anonymous module.\n" + | |
" define([ \"jquery\" ], factory );\n" + | |
" } else {\n" + | |
"\n" + | |
" // Browser globals\n" + | |
" factory( jQuery );\n" + | |
" }\n" + | |
"}(function( $ ) {"; | |
jsBundleOutro = "}));"; | |
function camelCase( input ) { | |
return input.toLowerCase().replace( /[-/](.)/g, function( match, group1 ) { | |
return group1.toUpperCase(); | |
}); | |
} | |
function Package() {} | |
extend( Package.prototype, { | |
"jquery.mobile.custom.js": function( callback ) { | |
amdBuilder( this.files, mobileRjsConfig, function( error, js ) { | |
if ( error ) { | |
return callback( error ); | |
} | |
// var banner = ...; | |
callback( null, banner + "\n" + js ); | |
}); | |
}, | |
"jquery.mobile.custom.structure.css": function( callback ) { | |
jqueryCssBuilder( this.files, "structure", mobileRjsConfig, function( error, css ) { | |
if ( error ) { | |
return callback( error ); | |
} | |
// var banner = ... | |
callback( null, banner + "\n" + css ); | |
}); | |
}); | |
}, | |
"jquery.mobile.custom.theme.css": function( callback ) { | |
jqueryCssBuilder( this.files, "structure", mobileRjsConfig, function( error, css ) { | |
if ( error ) { | |
return callback( error ); | |
} | |
// var banner = ... | |
callback( null, banner + "\n" + css ); | |
}); | |
}); | |
} | |
}); | |
module.exports = Package; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "jquery-mobile-package-definition", | |
"version": "0.0.1", | |
"dependencies": { | |
"builder-amd": "0.0.x", | |
"builder-jquery-css": "0.0.x", | |
"node-packager": "0.0.x" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment