Skip to content

Commit

Permalink
Update build related files for 4.0 beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
kabel committed Jul 1, 2013
1 parent c6d8f7a commit f270c6e
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 63 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.espressostorage
/sandbox/*
/sandbox
*_old.css
.externalToolBuilders
.settings
Expand All @@ -9,4 +9,5 @@

sharedcode/affiliate/less/buros.less
/UNL_WDNTemplates.sublime-*
/wdn/templates_4.0/css/all.css
/wdn/templates_4.0/css
/wdn/templates_4.0/scripts/compressed
33 changes: 31 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
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
41 changes: 0 additions & 41 deletions Makefile_old

This file was deleted.

21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string>` - The source path to the template resource directory
* `-p <string>` - 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.

Expand Down
2 changes: 1 addition & 1 deletion VERSION_DEP
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.16
4.0.0-beta2
2 changes: 1 addition & 1 deletion VERSION_HTML
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
4.0
40 changes: 40 additions & 0 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -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, '');
}
})

0 comments on commit f270c6e

Please sign in to comment.