Created
June 28, 2012 10:22
-
-
Save aristofor/3010522 to your computer and use it in GitHub Desktop.
custom bootstrap makefile
This file contains hidden or 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
# makefile pour thème bootstrap personnalisé | |
# | |
# usage dans un makefile supérieur: | |
# $(MAKE) ${MAKEFLAGS} BUILD_DIR=${BUILD_DIR}/theme BOOTSTRAP_SOURCE=${BOOTSTRAP_SOURCE} | |
# ou dans ce makefile: | |
# BUILD_DIR=./build | |
# BOOTSTRAP_SOURCE=${HOME}/src/bootstrap | |
# | |
# bootstrap 2.1.0-wip utilise normalement `recess` | |
# `lessc` permet de surcharger localement des .less (option "--include-path") | |
all: bootstrap | |
# all components | |
#BOOTSTRAP_COMPONENTS = transition alert button carousel collapse dropdown modal tooltip popover scrollspy tab typeahead | |
BOOTSTRAP_COMPONENTS = transition alert button | |
# original bootstrap.less : | |
# BOOTSTRAP_LESS = ${BOOTSTRAP_SOURCE}/less/bootstrap.less | |
# custom theme | |
BOOTSTRAP_LESS = bootstrap.less | |
BOOTSTRAP_RESPONSIVE = ${BOOTSTRAP_SOURCE}/docs/assets/css/bootstrap-responsive.css | |
BOOTSTRAP_RESPONSIVE_LESS = ${BOOTSTRAP_SOURCE}/less/responsive.less | |
JSMIN = $(shell which uglifyjs) | |
JSMIN_FLAGS = -nc | |
LESSC = $(shell which lessc) | |
LESSC_FLAGS= -O2 --include-path=".:${BOOTSTRAP_SOURCE}/less" | |
CSSMIN = $(LESSC) ${LESSC_FLAGS} --compress | |
BOOTSTRAP_COMPONENTS_JS = $(foreach comp,${BOOTSTRAP_COMPONENTS}, ${BOOTSTRAP_SOURCE}/js/bootstrap-${comp}.js) | |
%.min.js: %.js | |
$(JSMIN) ${JSMIN_FLAGS} $< > $@ | |
%.min.css: %.css | |
$(CSSMIN) $< > $@ | |
dirs: | |
mkdir -p ${BUILD_DIR}/js ${BUILD_DIR}/css ${BUILD_DIR}/img | |
JS_FILES = js/bootstrap.js js/jquery.js | |
JS_MIN_FILES = $(addprefix ${BUILD_DIR}/, $(patsubst %.js,%.min.js, ${JS_FILES}) ) | |
CSS_FILES = css/bootstrap.css css/bootstrap-responsive.css | |
CSS_MIN_FILES = $(addprefix ${BUILD_DIR}/, $(patsubst %.css,%.min.css, ${CSS_FILES}) ) | |
bootstrap: dirs bootstrap_img ${JS_FILES} ${JS_MIN_FILES} ${CSS_FILES} ${CSS_MIN_FILES} | |
js/bootstrap.js: ${BOOTSTRAP_COMPONENTS_JS} | |
cat $^ > ${BUILD_DIR}/$@ | |
js/jquery.js: ${BOOTSTRAP_SOURCE}/js/tests/vendor/jquery.js | |
cp $< ${BUILD_DIR}/$@ | |
bootstrap_img: | |
rsync -avc --delete ${BOOTSTRAP_SOURCE}/img/ ${BUILD_DIR}/img/ | |
css/bootstrap.css: ${BOOTSTRAP_LESS} ${BOOTSTRAP_RESPONSIVE_LESS} | |
$(LESSC) ${LESSC_FLAGS} $< > ${BUILD_DIR}/$@ | |
css/bootstrap-responsive.css: ${BOOTSTRAP_RESPONSIVE_LESS} | |
$(LESSC) ${LESSC_FLAGS} $< > ${BUILD_DIR}/$@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment