From bd4f020328661b0e21755b15b3897e2009a92634 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Jan 2016 19:12:23 +0000 Subject: [PATCH] Added conditional LESS builds for production --- package.json | 2 +- scripts/build-less.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 scripts/build-less.sh diff --git a/package.json b/package.json index 9a7fd10..f20f737 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build-js": "./scripts/build-js.sh", "create-build-dirs": "mkdir -p static/build/js/lib static/build/fonts static/build/css static/build/img", "build": "npm run create-build-dirs && npm run build-fonts && npm run build-images && npm run build-js && npm run build-less", - "build-less": "lessc --silent static/src/less/style.less static/build/css/style.css && cleancss -d --s0 -o static/build/css/style.css static/build/css/style.css", + "build-less": "./scripts/build-less.sh", "build-fonts": "cp -R node_modules/bootstrap/dist/fonts static/build/ && cp -R node_modules/ionicons/fonts static/build/ ", "build-images": "cp -r static/src/img/* static/build/img/", "watch-less": "watch 'npm run build-less' static/src/less/", diff --git a/scripts/build-less.sh b/scripts/build-less.sh new file mode 100755 index 0000000..9b0f06b --- /dev/null +++ b/scripts/build-less.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +if [[ $@ == **prod** ]] +then + echo ">>> WARNING: Building in Production Mode!" +fi + +echo ">> Building LESS..." +lessc --silent static/src/less/style.less static/build/css/style.css + +if [[ $@ == **prod** ]] +then + echo ">> Compressing LESS..." + cleancss -d --s0 -o static/build/css/style.css static/build/css/style.css +fi