Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Updated build system and src restructuring.
Browse files Browse the repository at this point in the history
Moved plugins into their own directories to keep the src directory
organised. Also removed packed version of the script in favour of a
simpler and faster build system. Updated README file.
  • Loading branch information
Craga89 committed Aug 20, 2011
1 parent aabff01 commit f5a856c
Show file tree
Hide file tree
Showing 20 changed files with 962 additions and 1,083 deletions.
84 changes: 37 additions & 47 deletions Makefile
Expand Up @@ -4,97 +4,87 @@ BUILD_DIR = build
PREFIX = .
DIST_DIR = ${PREFIX}/dist

PLUGINS = ${SRC_DIR}/ajax.js\
${SRC_DIR}/tips.js\
${SRC_DIR}/imagemap.js\
${SRC_DIR}/svg.js\
${SRC_DIR}/modal.js\
${SRC_DIR}/bgiframe.js
PLUGINS = $(shell ls -p ${SRC_DIR} | grep / | xargs)
PLUGINS_JS = $(if ${PLUGINS},$(shell find ${PLUGINS:%=${SRC_DIR}/%/} -name "*.js" 2> /dev/null),"")
PLUGINS_CSS = $(if ${PLUGINS},$(shell find ${PLUGINS:%=${SRC_DIR}/%/} -name "*.css" 2> /dev/null),"")

EXTRA_CSS = ${SRC_DIR}/styles.css\
${SRC_DIR}/extra.css

JS_MODULES = ${SRC_DIR}/header.txt\
${SRC_DIR}/intro.js\
${SRC_DIR}/core.js\
${PLUGINS}\
${PLUGINS_JS}\
${SRC_DIR}/outro.js

CSS_MODULES = ${SRC_DIR}/header.txt\
${SRC_DIR}/core.css\
${SRC_DIR}/tips.css\
${SRC_DIR}/modal.css\
${SRC_DIR}/styles.css\
${SRC_DIR}/extra.css
${PLUGINS_CSS}\
${EXTRA_CSS}

QTIP = ${DIST_DIR}/jquery.qtip.js
QTIP_MIN = ${DIST_DIR}/jquery.qtip.min.js
QTIP_PACK = ${DIST_DIR}/jquery.qtip.pack.js
QTIP_CSS = ${DIST_DIR}/jquery.qtip.css
QTIP_CSS_MIN = ${DIST_DIR}/jquery.qtip.min.css

QTIP_VER = `cat version.txt`
VER = sed s/@VERSION/${QTIP_VER}/

JS_ENGINE ?= `which node nodejs`
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
MINIFIER = java -Xmx96m -jar ${BUILD_DIR}/yuicompressor.jar
PACKER = java -jar ${BUILD_DIR}/js.jar ${BUILD_DIR}/packer.js
JS_ENGINE = `which nodejs`
JS_LINT = ${JS_ENGINE} $(BUILD_DIR)/jslint-check.js
JS_MINIFIER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --extra
CSS_MINIFIER = java -Xmx96m -jar ${BUILD_DIR}/yuicompressor.jar

DATE=`git log --pretty=format:'%ad' -1`

all: clean qtip lint css min pack
@@echo "qTip build complete."
all: clean qtip lint css min
@@echo ${PLUGIN_JS}
@@echo "qTip2 built successfully!\n"

${DIST_DIR}:
@@mkdir -p ${DIST_DIR}

qtip: ${DIST_DIR} ${QTIP}

${QTIP}: ${JS_MODULES}
qtip: ${DIST_DIR} ${JS_MODULES}
@@mkdir -p ${DIST_DIR}

@@echo "Building" ${QTIP}
@@echo "Building qTip2... Success!"
@@echo "\tEnabled plugins: " $(if ${PLUGINS},"${PLUGINS:%/=%}", "None") "\n"

@@cat ${JS_MODULES} | \
sed 's/Date:./&'"${DATE}"'/' | \
${VER} > ${QTIP};

min: ${QTIP_MIN}
css: ${DIST_DIR} ${CSS_MODULES}
@@echo -n "Building CSS... "
@@cat ${CSS_MODULES} | \
sed 's/Date:./&'"${DATE}"'/' | \
${VER} > ${QTIP_CSS};
@@echo "Success!"

${QTIP_MIN}: ${QTIP} ${QTIP_CSS}
min: qtip css
@@if test ! -z ${JS_ENGINE}; then \
echo "Building" ${QTIP_MIN}; \
echo -n "Minifying JS... "; \
head -18 ${QTIP} > ${QTIP_MIN}; \
${COMPILER} ${QTIP} > ${QTIP_MIN}.tmp; \
${JS_MINIFIER} ${QTIP} > ${QTIP_MIN}.tmp; \
sed '$ s#^\( \*/\)\(.\+\)#\1\n\2;#' ${QTIP_MIN}.tmp > ${QTIP_MIN}; \
rm -rf $(QTIP_MIN).tmp; \
echo "Success!"; \
else \
echo "You must have NodeJS installed in order to minify qTip JS."; \
fi

@@echo "Building" ${QTIP_CSS_MIN}
@@${MINIFIER} ${QTIP_CSS} --type css -o ${QTIP_CSS_MIN}

pack: ${QTIP_MIN}
@@echo "Building" ${QTIP_PACK}

@@head -18 ${QTIP} > ${QTIP_PACK}
@@${PACKER} ${QTIP_MIN} ${QTIP_PACK}.tmp
@@cat ${QTIP_PACK}.tmp >> ${QTIP_PACK} && rm ${QTIP_PACK}.tmp

css: ${QTIP_CSS}

${QTIP_CSS}: ${DIST_DIR} ${CSS_MODULES}
@@echo "Building" ${QTIP_CSS}
@@cat ${CSS_MODULES} | \
sed 's/Date:./&'"${DATE}"'/' | \
${VER} > ${QTIP_CSS};
@@echo -n "Minifying CSS... "
@@${CSS_MINIFIER} ${QTIP_CSS} --type css -o ${QTIP_CSS_MIN}
@@echo "Success!"

lint: ${QTIP}
lint: qtip
@@if test ! -z ${JS_ENGINE}; then \
echo "Checking jQuery against JSLint..."; \
${JS_ENGINE} $(BUILD_DIR)/jslint-check.js; \
echo -n "Checking against JSLint... "; \
${JS_LINT}; \
else \
echo "You must have NodeJS installed in order to test qTip against JSLint."; \
fi

clean:
@@echo "Removing distribution directory:" ${DIST_DIR}
@@echo "Removing distribution directory:" ${DIST_DIR} "\n"
@@rm -rf ${DIST_DIR}
28 changes: 17 additions & 11 deletions README.md
Expand Up @@ -3,7 +3,7 @@

Pre-compiled scripts
--------------------
If you're not interested in compiling your own version of qTip2, you can grab the pre-compiled scripts from the
If you're not interested in compiling your own version of qTip2, you can grab the pre-compiled scripts from the
[dist](http://github.com/Craga89/qTip2/tree/master/dist/) directory and get started quickly. If you want more options
over what plugins are included in your build, take a look below.

Expand Down Expand Up @@ -45,8 +45,7 @@ You can also create each individually using these commands:

make qtip # Build non-minified qTip2 source
make css # Build CSS files
make min # Build minified JS and CSS
make pack # Build minified and packed qTip2 JS (smallest filesize!)
make min # Build minified JS and CSS (Smaller filesize)

To build and test the source code against JSLint type this:

Expand All @@ -57,6 +56,13 @@ Finally, you can remove all the built files using the command:
make clean


Submitting a pull request to the qTip2 repository
-------------------------------------------------
If you're planning on submitting a pull request to the GitHub repository, you'll need to make sure your local git repo rebuilds the `dist/` directory on each commit. To do this,
simply copy the `hooks` folder into the `.git` directory. Inside here is a pre-commit script that will run `make` for you prior to each commit call. Make sure to make MAke installed as
detailed above


Building to a different directory
---------------------------------
If you want to build qTip2 to a directory that is different from the default location, you can specify the PREFIX
Expand All @@ -67,21 +73,21 @@ With this example, the output files would end up in `/home/craig/qtip/dist/`.

Choosing which features are included in your qTip2 build
--------------------------------------------------------
By default qTip2 is built with all plugins built into the file. You can see an example of this in the [dist](http://github.com/Craga89/qTip2/tree/master/dist/)
directory files. If you want more control over what plugins are included, you can do so by adding some extra parameters to your build commands.
By default qTip2 is built with all plugins enabled. You can see an example of this in the [dist](http://github.com/Craga89/qTip2/tree/master/dist/jquery.qtip.js) file.
If you want more control over what plugins are included, you can do so by adding some extra parameters to your build commands.

For example, if you plan on using only the tips plugin, you'd specify the plugins variable as so:

make PLUGINS="src/tips.js" [command]
make PLUGINS="tips" [command]

Notice the only thing that was added was the PLUGINS parameter. This tells the compiler which files to include in the final qTip2 build. You can specify multiple
plugins by separating them wit a space:
plugins by separating them with a space:

make PLUGINS="tips ajax modal" [command]

make PLUGINS="src/tips.js src/ajax.js src/modal.js" [command]

By default all plugins are included in the build, so the regular `[make all]` command is actually equivilent to:

make PLUGINS="src/ajax.js src/tips.js src/imagemap.js src/svg.js src/modal.js src/bgiframe.js" [command]
make PLUGINS="ajax tips imagemap svg modal bgiframe" [command]

* Note: The above was correct at the time of writing. Subsequent revisions may change file names or add new plugins, so checkout the Makefile for a full up-to-date list of all plugins*

Expand Down
2 changes: 1 addition & 1 deletion build/jslint-check.js
Expand Up @@ -31,5 +31,5 @@ if ( found > 0 ) {
print( "\n" + found + " Error(s) found.\n" );

} else {
print( "JSLint check passed.\n" );
print( "Success!\n" );
}
100 changes: 0 additions & 100 deletions build/packer.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/comment
@@ -0,0 +1 @@
Changed old modal selector to new filter
2 changes: 1 addition & 1 deletion dist/jquery.qtip.basic.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Aug 18 20:10:43 2011 +0100
* Date: Fri Aug 19 08:14:39 2011 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down
48 changes: 24 additions & 24 deletions dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Aug 18 20:10:43 2011 +0100
* Date: Fri Aug 19 08:14:39 2011 +0100
*/

/* Core qTip styles */
Expand Down Expand Up @@ -138,6 +138,29 @@
color: #111;
}

/* Modal plugin */
#qtip-overlay{
position: fixed;
left: -10000em;
top: -10000em;
}

/* Applied to modals with show.modal.blur set to true */
#qtip-overlay.blurs{ cursor: pointer; }

/* Change opacity of overlay here */
#qtip-overlay div{
position: absolute;
left: 0; top: 0;
width: 100%; height: 100%;

background-color: black;

opacity: 0.7;
filter:alpha(opacity=70);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}

/* Tips plugin */
.ui-tooltip .ui-tooltip-tip{
margin: 0 auto;
Expand All @@ -163,29 +186,6 @@
.ui-tooltip .ui-tooltip-tip canvas{ top: 0; left: 0; }


/* Modal plugin */
#qtip-overlay{
position: fixed;
left: -10000em;
top: -10000em;
}

/* Applied to modals with show.modal.blur set to true */
#qtip-overlay.blurs{ cursor: pointer; }

/* Change opacity of overlay here */
#qtip-overlay div{
position: absolute;
left: 0; top: 0;
width: 100%; height: 100%;

background-color: black;

opacity: 0.7;
filter:alpha(opacity=70);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}

/*! Light tooltip style */
.ui-tooltip-light .ui-tooltip-titlebar,
.ui-tooltip-light .ui-tooltip-content{
Expand Down

0 comments on commit f5a856c

Please sign in to comment.