Skip to content

Instantly share code, notes, and snippets.

@Dragod
Created February 2, 2021 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dragod/156e74bbbd9f3de5fed5d5f36a68957b to your computer and use it in GitHub Desktop.
Save Dragod/156e74bbbd9f3de5fed5d5f36a68957b to your computer and use it in GitHub Desktop.
.bashrc to run node build on unity
green='\e[32m'
blue='\e[34m'
clear='\e[0m'
#Green
GREEN=`tput setaf 2`
# Red
RED='\033[0;31m'
# reset the foreground colour
textreset=$(tput sgr0)
# Color Functions
ColorGreen(){
echo -ne $green$1$clear
}
ColorBlue(){
echo -ne $blue$1$clear
}
alert(){
echo -ne $RED$1$clear
}
#gnomon, https://github.com/paypal/gnomon
gnomon="| gnomon --medium=5.0 --high=10.0 --ignore-blank --real-time=100"
# Alias "core" for core css build.
# Alias "c skinName" for skin build.
# Alias "cc skinName" for core and skin build.
# Alias "all skinName" for complete build.
# Alias "admin" for admin build.
# Alias "login" to build login page.
# Alias "mobile" to build mobile.
# Alias "svg" to build svg.
# Compile core style with node
alias core="node build --type core --brand none ${gnomon}"
# Compile skin style with node
function skin()
{
if [ "$1" ]; then
eval "node build --type skin --brand $1 ${gnomon}"
else
echo -e -ne $(alert 'You did not pass any skin to css:skin so it will build the default skin: amazon-site-lite. To pass a different skin name use: "c skinName"')
eval "node build --type skin --brand amazon-site-lite ${gnomon}"
fi
}
alias c=skin
# Compile core & skin style with node
function core-colors()
{
if [ "$1" ]; then
eval "node build --type core-colors --brand $1 ${gnomon}"
else
echo -e -ne $(alert 'You did not pass any argument to css:skin so it will build the default skin: amazon-site-lite. To pass a different skin name use: "cc skinName"')
eval "node build --type core-colors --brand amazon-site-lite ${gnomon}"
fi
}
alias cc=core-colors
function mobile-colors()
{
if [ "$1" ]; then
eval "node build --type mobile-colors --brand $1 ${gnomon}"
else
echo -e -ne $(alert 'You did not pass any argument to css:skin so it will build the default skin: amazon-site-lite. To pass a different skin name use: "cc skinName"')
eval "node build --type core-colors --brand amazon-site-lite ${gnomon}"
fi
}
alias mc=mobile-colors
function build-all()
{
if [ "$1" ]; then
eval "node build --type all --brand $1 ${gnomon}"
else
echo -e -ne $(alert 'You did not pass any argument to css:skin so it will build the default skin: amazon-site-lite. To pass a different skin name use: "all skinName"')
eval "node build --type all --brand amazon-site-lite ${gnomon}"
fi
}
alias all=build-all
function build-wall()
{
if [ "$1" ]; then
eval "node build --type wall --brand $1 ${gnomon}"
else
echo -e -ne $(alert 'You did not pass any argument to css:skin so it will build the default skin: amazon-site-lite. To pass a different skin name use: "all skinName"')
eval "node build --type all --brand amazon-site-lite ${gnomon}"
fi
}
alias wall=build-wall
alias mobile="node build --type mobile --brand none ${gnomon}"
alias admin="node build --type admin --brand none ${gnomon}"
alias login="node build --type login --brand none ${gnomon}"
alias svg="node build --type svg --brand none ${gnomon}"
function unity-builds()
{
# Define functions costant text
CORE="Build core css. Ex: core"
COLORS="Build skin css. Ex: c ioc"
CORECOLORS="Build core and skin css. Ex: cc ioc"
MOBILECOLORS="Build mobile and skin css. Ex: cc ioc"
MOBILE="Build mobile core css."
ALL="Build complete. Ex: all ioc"
ADMIN="Build admin css."
LOGIN="Build login page css."
SVG="Build svg sprite."
WALLOFTEXT="Build complete without any fancy color & messages. Ex: wall ioc"
printf "\n${GREEN}Node-sass builds:\n\n"
printf "${GREEN}core${textreset} \"${CORE}\"\n"
printf "${GREEN}c \`skin-name\`${textreset} \"${COLORS}\"\n"
printf "${GREEN}cc \`skin-name\`${textreset} \"${CORECOLORS}\"\n"
printf "${GREEN}all \`skin-name\`${textreset} \"${ALL}\"\n"
printf "${GREEN}wall \`skin-name\`${textreset} \"${WALLOFTEXT}\"\n"
printf "${GREEN}admin${textreset} \"${ADMIN}\"\n"
printf "${GREEN}mobile${textreset} \"${MOBILE}\"\n"
printf "${GREEN}mc \`skin-name\`${textreset} \"${MOBILECOLORS}\"\n"
printf "${GREEN}login${textreset} \"${LOGIN}\"\n"
printf "${GREEN}svg${textreset} \"${SVG}\"\n"
}
alias unity=unity-builds
printf "\n${GREEN}List of commands:\n\n"
printf "${textreset}* Type ${GREEN}'unity'${textreset} for a list of unity-40 build\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment