Added conditional LESS builds for production
This commit is contained in:
parent
b5d937d9b9
commit
bd4f020328
2 changed files with 18 additions and 1 deletions
|
@ -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/",
|
||||
|
|
17
scripts/build-less.sh
Executable file
17
scripts/build-less.sh
Executable file
|
@ -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
|
Reference in a new issue