Skip to content
Snippets Groups Projects
Commit 41215ab6 authored by Kevin Abel's avatar Kevin Abel
Browse files

Remove Makefile that will be replaced by grunt

parent f723eff1
No related branches found
No related tags found
1 merge request!64.1
SHELL := /bin/bash
CURL := curl
# NodeJS Find/Install
NODE_PATH = $(shell ./find-node-or-install)
PATH := $(NODE_PATH):$(shell echo $$PATH)
# External Build Tools
NODE_DIR = node_modules
LESSC = $(NODE_DIR)/less/bin/lessc
UGLIFYJS = $(NODE_DIR)/uglify-js/bin/uglifyjs
# Local Vars
LESS_LIB = www/less/lib
# External Dependencies
LESSHAT := $(LESS_LIB)/lesshat.less
WDN_MIXINS := \
$(LESS_LIB)/breakpoints.less \
$(LESS_LIB)/colors.less \
$(LESS_LIB)/fonts.less
WDN_LIB_RAW = https://raw.githubusercontent.com/unl/wdntemplates/master/wdn/templates_4.0/less/_mixins/
LESSHAT_RAW = https://raw.githubusercontent.com/csshat/lesshat/c8c211b2442734bfc1ae2509ff0ccebdc2e73664/build/lesshat.less
# Built Files
CSS_OBJ = www/css/search.css
JS_OBJ = www/js/search.min.js
all: less js
less: $(CSS_OBJ)
js: $(JS_OBJ)
clean:
rm -r $(NODE_DIR)
rm -r $(LESS_LIB)
rm $(JS_OBJ)
rm $(CSS_OBJ)
$(CSS_OBJ): www/less/search.less $(LESSC) $(LESSHAT) $(WDN_MIXINS)
$(LESSC) --clean-css $< $@
$(LESSC):
npm install less less-plugin-clean-css
$(LESS_LIB)/%.less:
@mkdir -p $(@D)
$(CURL) -s $(WDN_LIB_RAW)$(@F) -o $@
$(LESSHAT):
@mkdir -p $(@D)
$(CURL) -s $(LESSHAT_RAW) -o $@
$(UGLIFYJS):
npm install uglify-js
$(JS_OBJ): www/js/search.js $(UGLIFYJS)
$(UGLIFYJS) -c -m -o $@ -p 2 --source-map $(<).map --source-map-url $(<F).map $<
.PHONY: all less js clean
#!/bin/bash
##############################################################################
# Finds the bin directory where node and npm are installed, or installs a
# local copy of them in a temp folder if not found. Then outputs where they
# are.
#
# Usage and install instructions:
# https://github.com/hugojosefson/find-node-or-install
##############################################################################
# Creates temp dir which stays the same every time this script executes
function setTEMP_DIR()
{
local NEW_OS_SUGGESTED_TEMP_FILE=$(mktemp -t asdXXXXX)
local OS_ROOT_TEMP_DIR=$(dirname ${NEW_OS_SUGGESTED_TEMP_FILE})
rm ${NEW_OS_SUGGESTED_TEMP_FILE}
TEMP_DIR=${OS_ROOT_TEMP_DIR}/nvm
mkdir -p ${TEMP_DIR}
}
# Break on error
set -e
# Try to find node, but don't break if not found
NODE=$(which node || true)
if [[ -n "${NODE}" ]]; then
# Good. We found it.
echo $(dirname ${NODE})
else
# Did not find node. Better install it.
# Do it in a temp dir, which stays the same every time this script executes
setTEMP_DIR
cd ${TEMP_DIR}
# Do we have nvm here?
if [[ ! -d "nvm" ]]; then
git clone git://github.com/creationix/nvm.git >/dev/null
fi
# Clear and set NVM_* env variables to our installation
mkdir -p .nvm
export NVM_DIR=$( (cd .nvm && pwd) )
unset NVM_PATH
unset NVM_BIN
# Load nvm into current shell
. nvm/nvm.sh >/dev/null
# Install and use latest 0.10.* node
nvm install 0.10 >/dev/null
nvm alias default 0.10 >/dev/null
nvm use default >/dev/null
# Find and output node's bin directory
NODE=$(which node)
echo $(dirname ${NODE})
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment