Since I had to get the latest trunk version of jQuery for latest patch, I
decided to re-adapt my work in progress "yuibompressor" to build in a click
under windows via batch files.
*
jquery/modules.txt*
intro.js
core.js
data.js
selector.js
traversing.js
attributes.js
manipulation.js
event.js
support.js
css.js
ajax.js
fx.js
offset.js
dimensions.js
outro.js
Above file is basically the list of files to include to create a single
version of jQuery, copy and paste into jquery folder and be sure that there
are no spaces at the beginning or at the end (new lines as well)
To make the build possible we need the batch script:
*build.bat*
@echo off
rem ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rem ;; WebReflection YUI Compressor Batch Manager ;;
rem ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rem ;; your project name. will produce two files
rem ;; projectname.min.[js/css]
rem ;; projectname.debug.[js/css]
rem ;; debug version is a single big file not compressed
set YUI_BUILD_NAME=jquery-dev
rem ;; pause program execution or each main step [1/0]
set YUI_DEBUG=0
rem ;; specify the project type [js/css]
set YUI_TYPE=js
rem ;; where is yuicompressor-ver.jar
set YUI_FOLDER=build
rem ;; a txt file with a list of files to include in the project
rem ;; NOTE: the file order is preserved
rem ;; NOTE: if YUI_FOLDER_SOURCE is not set each file must have an absolute
path
set YUI_FILE_LIST=modules.txt
rem ;; where to put min and debug version of the project
set YUI_FOLDER_DEST=dist
rem ;; where are files specified in the list
rem ;; NOTE: if files in the list have absolute path please remove this
variable
rem ;; writing "rem" instead of "set" as prefix
set YUI_FOLDER_SOURCE=src
rem ;; specify if you do not want to munge file (obfuscation)
rem ;; NOTE: YUICompressor is a great tool but sometimes it could have some
problem with munge option
set YUI_NO_MUNGE=1
rem ;; yuicompressor jar file version
rem ;; NOTE: this variable is used as
yuicompressor-%YUI_COMPRESSOR_VERSION%.jar
rem ;; please be sure that jar file respects this naming convention
rem ;; EXAMPLE: yuicompressor-2.4.2.jar
set YUI_COMPRESSOR_VERSION=2.4.2
rem ;; Set --no-mounge Only If Necessary
if "%YUI_NO_MUNGE%"=="1" (
if "%YUI_TYPE%"=="js" set YUI_NOMUNGE=--nomunge
if not "%YUI_TYPE%"=="js" set YUI_NOMUNGE=
)
if not "%YUI_NO_MUNGE%"=="1" set YUI_NOMUNGE=
rem ;; Start Script Execution
goto show_summary
:build_minified_version
rem ;; After The Unique Big File Has Been Created Creates The Single
Compressed One
echo.
echo Creating build
echo.
java -jar "%YUI_FOLDER%\yuicompressor-%YUI_COMPRESSOR_VERSION%.jar"
--charset=UTF-8 --type=%YUI_TYPE% %YUI_NOMUNGE%
"%YUI_FOLDER%\full.%YUI_TYPE%" -o "%YUI_FOLDER%\min.%YUI_TYPE%"
echo ____________________________________
echo.
if "%YUI_DEBUG%"=="1" pause>nul
goto copy_and_remove
:copy_and_remove
rem ;; Merge With An Header The Compressed File. Move Files Into
Destination Folder
echo.
echo Copying and removing files
echo.
echo./** %YUI_BUILD_NAME% - %DATE% %TIME%
*/>"%YUI_FOLDER%\%YUI_BUILD_NAME%.min.%YUI_TYPE%"
TYPE
"%YUI_FOLDER%\min.%YUI_TYPE%">>"%YUI_FOLDER%\%YUI_BUILD_NAME%.min.%YUI_TYPE%"
rem ;; NOTE: If Files Are Not Present This Command May Ask If It Is A
File Or A Directory - Please Press F
rem ;; NOTE: If Files Were Present This Command Forces Overwrites (In
Visual Studio Solution Folders As Well)
xcopy /Y /V /R /Q /Z "%YUI_FOLDER%\%YUI_BUILD_NAME%.min.%YUI_TYPE%"
"%YUI_FOLDER_DEST%\%YUI_BUILD_NAME%.min.%YUI_TYPE%"
xcopy /Y /V /R /Q /Z "%YUI_FOLDER%\full.%YUI_TYPE%"
"%YUI_FOLDER_DEST%\%YUI_BUILD_NAME%.debug.%YUI_TYPE%"
del "%YUI_FOLDER%\min.%YUI_TYPE%"
del "%YUI_FOLDER%\full.%YUI_TYPE%"
del "%YUI_FOLDER%\%YUI_BUILD_NAME%.min.%YUI_TYPE%"
echo ____________________________________
echo.
if "%YUI_DEBUG%"=="1" pause>nul
goto end_procedure
:end_procedure
rem ;; Hopefully Everything Is OK - It Is Time To Exit
echo.
echo Done
echo ____________________________________
if "%YUI_DEBUG%"=="1" pause>nul
exit
:show_file_list_and_append_content
rem ;; Performs Checks For Each File In The List
echo.
echo File Analysis
echo ------------------------------------
for /f "delims=" %%G in (%YUI_FILE_LIST%) do (
echo %%G
type "%YUI_FOLDER_SOURCE%\%%G">"%YUI_FOLDER%\tmp"
if "%YUI_DEBUG%"=="1" (
if not "%%G"=="intro.js" (
if not "%%G"=="outro.js" (
java -jar
"%YUI_FOLDER%\yuicompressor-%YUI_COMPRESSOR_VERSION%.jar" --charset=UTF-8
--type=%YUI_TYPE% %YUI_NOMUNGE% "%YUI_FOLDER%\tmp" -o "%YUI_FOLDER%\tmp.min"
del "%YUI_FOLDER%\tmp.min"
if not "%errorlevel%"=="0" (
echo.Warning: Errors during compression
pause>nul
del "%YUI_FOLDER%\tmp"
exit
)
)
)
)
TYPE "%YUI_FOLDER%\tmp">>"%YUI_FOLDER%\full.%YUI_TYPE%"
del "%YUI_FOLDER%\tmp"
)
echo ____________________________________
echo.
if "%YUI_DEBUG%"=="1" pause>nul
goto build_minified_version
:show_summary
rem ;; Initial Screen Mit Style License Please Do Not Remove My Credits
echo ____________________________________
echo.
echo (C) Andrea Giammarchi @WebReflection
echo YUI Batch Build System V 1.0
echo.
echo ------------------------------------
echo %YUI_BUILD_NAME%
echo ------------------------------------
echo Date %DATE% %TIME%
echo Type %YUI_TYPE%
echo Place %YUI_FOLDER%
echo Destination %YUI_FOLDER_DEST%
echo List %YUI_FILE_LIST%
if "%YUI_DEBUG%"=="1" (echo Debug ON)
if not "%YUI_DEBUG%"=="1" (echo Debug OFF)
echo ____________________________________
echo.
if "%YUI_DEBUG%"=="1" pause>nul
goto show_file_list_and_append_content
rem ;; Enjoy Your Compressed File - Thank You YUICompressor
The first time it could ask if destination file is a file or a directory,
just press F.
Best Regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---