Last active
October 12, 2022 18:02
-
-
Save marcanuy/fefafbd617201aee2892666ee2d28761 to your computer and use it in GitHub Desktop.
Makefiles to handle Jekyll websites https://simpleit.rocks/how-to-add-bootstrap-4-to-jekyll-the-right-way/
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
SHELL := /bin/bash | |
YARN := yarn | |
VENDOR_DIR = assets/vendor/ | |
JEKYLL := jekyll | |
PROJECT_DEPS := package.json | |
.PHONY: all clean install update | |
all : serve | |
check: | |
$(JEKYLL) doctor | |
$(HTMLPROOF) --check-html \ | |
--http-status-ignore 999 \ | |
--internal-domains localhost:4000 \ | |
--assume-extension \ | |
_site | |
install: $(PROJECT_DEPS) | |
$(YARN) install | |
update: $(PROJECT_DEPS) | |
$(YARN) upgrade | |
include-yarn-deps: | |
mkdir -p $(VENDOR_DIR) | |
cp node_modules/jquery/dist/jquery.min.js $(VENDOR_DIR) | |
cp node_modules/popper.js/dist/uml/popper.min.js $(VENDOR_DIR) | |
cp node_modules/bootstrap/dist/js/bootstrap.min.js $(VENDOR_DIR) | |
build: install include-yarn-deps | |
$(JEKYLL) build | |
serve: install include-yarn-deps | |
JEKYLL_ENV=production $(JEKYLL) serve |
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
SHELL := /bin/bash | |
BUNDLE := bundle | |
YARN := yarn | |
VENDOR_DIR = assets/vendor/ | |
JEKYLL := $(BUNDLE) exec jekyll | |
PROJECT_DEPS := Gemfile package.json | |
.PHONY: all clean install update | |
all : serve | |
check: | |
$(JEKYLL) doctor | |
$(HTMLPROOF) --check-html \ | |
--http-status-ignore 999 \ | |
--internal-domains localhost:4000 \ | |
--assume-extension \ | |
_site | |
install: $(PROJECT_DEPS) | |
$(BUNDLE) install --path vendor/bundler | |
$(YARN) install | |
update: $(PROJECT_DEPS) | |
$(BUNDLE) update | |
$(YARN) upgrade | |
include-yarn-deps: | |
mkdir -p $(VENDOR_DIR) | |
cp node_modules/jquery/dist/jquery.min.js $(VENDOR_DIR) | |
cp node_modules/popper.js/dist/uml/popper.min.js $(VENDOR_DIR) | |
cp node_modules/bootstrap/dist/js/bootstrap.min.js $(VENDOR_DIR) | |
build: install include-yarn-deps | |
$(JEKYLL) build | |
serve: install include-yarn-deps | |
JEKYLL_ENV=production $(JEKYLL) serve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've found your tutorial very helpful - thank you!
I seem to be missing something once I get to the section titled "OPTIONAL: Keep node_modules out of _site". I would like to keep node_modules out _site for production build. I don't have a preference on using Bundler or not. It's unclear to me whether I name this file
Makefile
orGemfile
? And once that's decided, which gist code above do I use? If I useGemfile
are my build commands nowmake build
andmake serve
?My public repo: https://github.com/funraise-af/jekyll-bootstrap4
The closest I got was jquery.min.js being generated in the /assets/vendor/ folder, but jQuery does not get removed from the _site folder.
Any help would be greatly appreciated!