From f270c6ec5067c4c4ae5e8b672622594e4f715ab0 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Mon, 1 Jul 2013 15:55:07 -0500 Subject: [PATCH] Update build related files for 4.0 beta release --- .gitignore | 5 +++-- Makefile | 33 +++++++++++++++++++++++++++++++-- Makefile_old | 41 ----------------------------------------- README.md | 21 +++++---------------- VERSION_DEP | 2 +- VERSION_HTML | 2 +- build/build.js | 40 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 81 insertions(+), 63 deletions(-) delete mode 100644 Makefile_old create mode 100644 build/build.js diff --git a/.gitignore b/.gitignore index b80bdc0c4..5810bcfd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *.espressostorage -/sandbox/* +/sandbox *_old.css .externalToolBuilders .settings @@ -9,4 +9,5 @@ sharedcode/affiliate/less/buros.less /UNL_WDNTemplates.sublime-* -/wdn/templates_4.0/css/all.css \ No newline at end of file +/wdn/templates_4.0/css +/wdn/templates_4.0/scripts/compressed diff --git a/Makefile b/Makefile index fd2a7bff4..32bac7ea6 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,31 @@ -all: - lessc wdn/templates_4.0/less/all.less wdn/templates_4.0/css/all.css --yui-compress --line-numbers=comments \ No newline at end of file +export PATH := $(PATH):build/bin +TEMPLATE_DIR := wdn/templates_4.0 + +GIT := git + +LESSC := lessc +LESSC_FLAGS := --yui-compress --line-numbers=comments +LESS_OBJS := all.less +LESS_OUT ?= $(LESS_OBJS:.less=.css) + +RJS := r.js +RJS_FLAGS := +JS_BUILD_CONF := build/build.js + +all: less js + +less: + $(LESSC) $(LESSC_FLAGS) $(TEMPLATE_DIR)/less/$(LESS_OBJS) $(TEMPLATE_DIR)/css/$(LESS_OUT) + +js: + $(RJS) -o $(JS_BUILD_CONF) $(RJS_FLAGS) + +clean: + rm -rf $(TEMPLATE_DIR)/css + rm -rf $(TEMPLATE_DIR)/scripts/compressed + +zips: all + zip -qr downloads/wdn.zip wdn + ${GIT} archive --format=zip HEAD Templates sharedcode > downloads/UNLTemplates.zip + +.PHONY: all clean less js zips diff --git a/Makefile_old b/Makefile_old deleted file mode 100644 index c59f2cd62..000000000 --- a/Makefile_old +++ /dev/null @@ -1,41 +0,0 @@ -# -# Makefile for WDN Template Dependents Build -# - -COMPRESS_FLAGS = -JS_COMPILER = - -COMPRESS = php build/compress.php ${COMPRESS_FLAGS} ${JS_COMPILER} -GIT = git -JAVA = java - -JS_PLUGIN = wdn/templates_3.1/scripts/plugins/validator/jquery.validator.min.js -JS_SRC = wdn/templates_3.1/scripts/plugins/validator/jquery.validator.js - -all: - @@echo "Compressing Desktop and Mobile CSS and JS" - ${COMPRESS} - @@echo "Done" - -clean: - ${COMPRESS} clean - -debug: - ${COMPRESS} debug - -less: - ${COMPRESS} less - -zips: all - @@echo "Making ZIPs" - zip -qr downloads/wdn.zip wdn - @@echo "Done building the wdn.zip file." - ${GIT} archive --format=zip HEAD Templates sharedcode > downloads/UNLTemplates.zip - @@echo "Done building the UNLTemplates.zip file." - -js-plugin: ${JS_PLUGIN} - -${JS_PLUGIN}: ${JS_SRC} - ${JAVA} -jar build/bin/compiler.jar --js=${JS_SRC} --js_output_file=${JS_PLUGIN} - -.PHONY: all clean debug less less-css zips js-plugin \ No newline at end of file diff --git a/README.md b/README.md index 9c3987fdf..fb0045a60 100644 --- a/README.md +++ b/README.md @@ -14,38 +14,27 @@ All templates variations utilize the same HTML markup, with an exception of the All members of the WDN are invited to contribute to this project. Please make a fork of the [main repository](https://github.com/unl/wdntemplates) for local development. Once you have created and tested your code, please send a pull request to the main repository. -### Building Template Resources +## Building Template Resources Much of the template CSS and JavaScript is built using aggregators, preprocessors, and/or "minifiers". You can build a local copy of these resources with the following instructions as your guide. The resources are built using a standard Makefile for [GNU Make](http://www.gnu.org/software/make/). The Makefile uses a few additional build dependencies that MUST be installed prior to building. * [Git](http://git-scm.com/) -- version control system -* [Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html) OR [UglifyJS](https://github.com/mishoo/UglifyJS) -- used for "minifying" javascript -* [NodeJS](http://www.nodejs.org/) -- used to run the libraries that convert LESS to CSS and, optionally, UglifyJS -* [PHP](http://php.net) v5.3+ -- used as a file aggregator and an extension of GNU Make (php-cli; server not necessary) +* [NodeJS](http://www.nodejs.org/) -- used to run the libraries that process and minimize LESS and JS files Once all of the above dependencies are met, simply running GNU Make `make` at the project root will build all resources. The following are all of the supported targets for `make`. * `all` - builds all needed CSS and JavaScript * `clean` - removes all built files -* `debug` - builds debugging CSS files +* `js` - builds and minifies combined JS * `less` - builds all CSS files from their LESS counterparts * `zips` - builds the ZIP's used for template distribution -The JavaScript build process can be further customized by passing some flags via an environment variable to GNU Make (`COMPRESS_FLAGS`). The following are the flags that are supported. - -* `-f` - Force all resources to be rebuilt -* `-c [closure|uglify-js]` - JavaScript compiler option -* `-v` - Output verbose build progress -* `-d ` - The source path to the template resource directory -* `-p ` - The URI path to where the templates will be accessed via the web server (the default is the server root `/`) - -__EXAMPLE:__ Force a rebuild and use the uglifyJS library -`COMPRESS_FLAGS="-c uglify-js -f" make` +The JavaScript build process can be further customized by passing parameters GNU Make. The following are the flags that are supported. __EXAMPLE:__ Build for use in a special CDN or server location -`COMPRESS_FLAGS="-p //www.unl.edu/" make` +`make RJS_FLAGS="wdnTemplatePath=//www.unl.edu/"` __PLEASE NOTE:__ The build process has been optimized for a Linux or OS X environment. While it is technically possible to build on Windows, the specifics of setting up your environment correctly are beyond the scope of this project. diff --git a/VERSION_DEP b/VERSION_DEP index e6291b96f..e45ff35c9 100644 --- a/VERSION_DEP +++ b/VERSION_DEP @@ -1 +1 @@ -3.1.16 +4.0.0-beta2 diff --git a/VERSION_HTML b/VERSION_HTML index 06a445799..389f7740e 100644 --- a/VERSION_HTML +++ b/VERSION_HTML @@ -1 +1 @@ -3.1 \ No newline at end of file +4.0 \ No newline at end of file diff --git a/build/build.js b/build/build.js new file mode 100644 index 000000000..3f556020e --- /dev/null +++ b/build/build.js @@ -0,0 +1,40 @@ +({ + baseUrl: '../wdn/templates_4.0/scripts/', + paths: { + 'requireLib': 'require' + }, + shim: { + 'wdn_ajax': { + deps: ['jquery'], + exports: 'WDN.jQuery.ajaxSettings.proxyKey' + } + }, + optimize: 'uglify2', + logLevel: 2, + + name: 'wdn', + include: [ + 'wdn_ajax', + 'requireLib', + 'modernizr-wdn', + 'main', + 'analytics', + 'navigation', + 'search', + 'legacy' + ], + insertRequire: ['main'], + wdnTemplatePath: '/', + out: '../wdn/templates_4.0/scripts/compressed/all.js', + onBuildWrite: function (moduleName, path, contents) { + if (moduleName === 'wdn') { + if (this.wdnTemplatePath) { + contents = contents.replace(/\/\/#TEMPLATE_PATH/, 'template_path="' + this.wdnTemplatePath + '";'); + } + + contents += 'window.WDN.jQuery = window.jQuery.noConflict(true);\n'; + } + + return contents.replace(/WDN\.log\([^)]*\);?/g, ''); + } +})