Last active
January 11, 2016 16:07
-
-
Save curiouscrusher/3b66f41cae39f8501879 to your computer and use it in GitHub Desktop.
A Makefile to get wordpress up and running, as well as compile sass in your custom theme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# About | |
# -------------------------------------------------- | |
# This script can: | |
# - Install a clean WordPress | |
# - Compile SASS | |
# | |
# Requirements | |
# -------------------------------------------------- | |
# You need `make` and `sass` installed | |
# Ensure the correct paths are linked in `.bashrc` for deployments | |
# | |
# Use | |
# -------------------------------------------------- | |
# Run | |
# $ make -- Compile CSS | |
# $ make theme-css -- Compile CSS | |
# $ make wordpress -- Install WordPress | |
# $ make clean-wordpress -- Remove default themes and plugins | |
# | |
# Default Values | |
# -------------------------------------------------- | |
# Download destination | |
ARCHIVE_DIR = /tmp/ | |
# WordPress | |
WORDPRESS_LATEST = http://wordpress.org/latest.tar.gz | |
WORDPRESS_DIR = ${PWD} | |
WORDPRESS_ARCHIVE = ${ARCHIVE_DIR}wordpress-latest.tgz | |
WORDPRESS_THEMES = wp-content/themes | |
WORDPRESS_PLUGINS = wp-content/plugins | |
# Theme | |
THEME_DIR = ${WORDPRESS_THEMES}/YOUR_THEME_NAME | |
SASS_DIR = ${THEME_DIR}/scss | |
SASS_FILE = ${THEME_DIR}/scss/style.scss | |
CSS_DIR = ${THEME_DIR}/css | |
CSS_FILE = ${THEME_DIR}/css/style.css | |
DATE = $(shell date +%H:%M:%S) | |
CHECK = \033[32m✔\033[39m | |
# | |
# Build CSS | |
# -------------------------------------------------- | |
build: theme-css | |
# | |
# CSS COMPILE | |
# -------------------------------------------------- | |
theme-css: | |
@printf "Compile theme scss files...\n" | |
@mkdir -p ${THEME_DIR}/css; | |
@sass -qt compressed --update -f ${SASS_DIR}:${CSS_DIR} | |
@ruby autoprefix.rb ${CSS_FILE}; | |
@printf "${CHECK} ${CSS_DIR}/${CSS_FILE}\n"; | |
@printf "Compile theme scss files... ${CHECK} Done | ${DATE}\n" | |
# | |
# Install WordPress | |
# -------------------------------------------------- | |
wordpress: | |
@printf "Installing WordPress...\n" | |
@if [ ! -f ${WORDPRESS_ARCHIVE} ] \ | |
|| ! ( echo `curl -Ls ${WORDPRESS_LATEST}.sha1` \*${WORDPRESS_ARCHIVE} \ | |
| shasum -c - &>/dev/null 2>&1 ); \ | |
then printf "Downloading...\n"; \ | |
curl -\#Lo ${WORDPRESS_ARCHIVE} ${WORDPRESS_LATEST}; \ | |
fi | |
@printf "Extracting...\n" | |
@tar -xzf ${WORDPRESS_ARCHIVE} -C ${WORDPRESS_DIR} --strip-components=1 | |
@rm -rf \ | |
${WORDPRESS_PLUGINS}/hello.php \ | |
${WORDPRESS_PLUGINS}/akismet \ | |
${WORDPRESS_THEMES}/twenty* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment