Skip to content

Instantly share code, notes, and snippets.

@marcanuy
Last active October 12, 2022 18:02
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marcanuy/fefafbd617201aee2892666ee2d28761 to your computer and use it in GitHub Desktop.
Save marcanuy/fefafbd617201aee2892666ee2d28761 to your computer and use it in GitHub Desktop.
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
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
@funraise-af
Copy link

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 or Gemfile? And once that's decided, which gist code above do I use? If I use Gemfile are my build commands now make build and make 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment