Skip to content
Browse files

Build: Concatenate source files in docs/demos/_assets/js into docs/de…

…mos/_assets/jquery.mobile.demos.js and sed the reference to _assets/js/ in docs/demos/*{html,php} to _assets/js/jquery.mobile.demos.js
  • Loading branch information...
1 parent b2ee3c3 commit 991f8762128dbdee428cf74043dc258c242f6bef @gabrielschulhof gabrielschulhof committed Jan 3, 2013
Showing with 15 additions and 3 deletions.
  1. +1 −0 build/bin/config.sh
  2. +3 −1 build/bin/docs.sh
  3. +11 −2 grunt.js
View
1 build/bin/config.sh
@@ -27,6 +27,7 @@ OUTPUT="compiled"
# The name of the files
NAME="jquery.mobile"
+DEMOSNAME="jquery.mobile.demos"
BASE_NAME="jquery.mobile"
THEME_FILENAME="jquery.mobile.theme"
STRUCTURE="jquery.mobile.structure"
View
4 build/bin/docs.sh
@@ -13,6 +13,8 @@ cp compiled/*.css tmp/demos/css/themes/$THEME
cp -r compiled/images tmp/demos/css/themes/$THEME
# ... replace "js/" with "js/jquery.mobile.js"
# NOTE the deletion here is required by gnu/bsd sed differences
+find tmp/demos/docs/demos \( -name '*.html' -o -name '*.php' \) -exec sed -i${SED_INPLACE_EXT} -e "s@_assets/js/\"@_assets/js/$DEMOSNAME.js\"@" {} \;
+find tmp/demos/docs/demos -name "*$SED_INPLACE_EXT" -exec rm {} \;
find tmp/demos \( -name '*.html' -o -name '*.php' \) -exec sed -i${SED_INPLACE_EXT} -e "s@js/\"@js/$NAME.js\"@" {} \;
find tmp/demos -name "*$SED_INPLACE_EXT" -exec rm {} \;
# make sure the docs reference the right css file names (for deploy)
@@ -29,4 +31,4 @@ cd tmp/demos && zip -rq ../../$OUTPUT/$NAME.docs.zip * && cd -
rm -rf $OUTPUT/demos && mv -f tmp/demos $OUTPUT
# Finish by removing the temporary files
-rm -rf tmp
+rm -rf tmp
View
13 grunt.js
@@ -2,7 +2,7 @@ var path = require( 'path' ), fs = require( 'fs' );
module.exports = function( grunt ) {
var dirs, names, min = {}, cssmin = {},
- theme, rootFile, structureFile, themeFile,
+ theme, rootFile, structureFile, themeFile, demosjsFile,
verOfficial, suffix;
dirs = {
@@ -18,6 +18,7 @@ module.exports = function( grunt ) {
base: 'jquery.mobile' + suffix,
// this will change for the deploy target to include version information
root: 'jquery.mobile' + suffix,
+ demosjs: 'jquery.mobile.demos' + suffix,
structure: 'jquery.mobile.structure' + suffix,
theme: 'jquery.mobile.theme' + suffix
};
@@ -26,6 +27,7 @@ module.exports = function( grunt ) {
return path.join( dirs.output, name );
}
+ demosjsFile = path.join( dirs.output, "demos", "docs", "demos", "_assets", "js", names.demosjs );
rootFile = outputPath( names.root );
structureFile = outputPath( names.structure );
themeFile = outputPath( names.theme );
@@ -88,6 +90,13 @@ module.exports = function( grunt ) {
dest: rootFile + '.js'
},
+ demosjs: {
+ src: [ '<banner:global.ver.header>',
+ path.join( 'docs', 'demos', '_assets', 'js', 'jqm-demos.js' ),
+ path.join( 'docs', 'demos', '_assets', 'js', 'view-source.js' ) ],
+ dest: demosjsFile + '.js'
+ },
+
structure: {
src: [ '<banner:global.ver.header>', structureFile + '.compiled.css' ],
dest: structureFile + '.css'
@@ -200,7 +209,7 @@ module.exports = function( grunt ) {
grunt.registerTask('test', 'config:test:pages config:test junit');
// Ease of use aliases for users who want the zip and docs
- grunt.registerTask('docs', 'js css legacy_tasks:docs');
+ grunt.registerTask('docs', 'js css legacy_tasks:docs concat:demosjs');
grunt.registerTask('zip', 'js css legacy_tasks:zip');
// load the project's default tasks

0 comments on commit 991f876

Please sign in to comment.
Something went wrong with that request. Please try again.