Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
doc/_build/
node_modules/
pkg/
.sass-cache/
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
BROWSERIFY := node_modules/.bin/browserify
UGLIFYJS := node_modules/.bin/uglifyjs
CLEANCSS := node_modules/.bin/cleancss
SASSC = node_modules/.bin/node-sass

# Check that the user has run 'npm install'
ifeq ($(shell which $(BROWSERIFY) >/dev/null 2>&1; echo $$?), 1)
Expand All @@ -13,7 +15,7 @@ EXT := \

SRC := $(shell find src -type f -name '*.js')

all: annotator exts
all: annotator exts sass minifyCss

annotator: pkg/annotator.min.js
exts: $(patsubst %,pkg/annotator.%.min.js,$(EXT))
Expand All @@ -22,6 +24,16 @@ pkg/%.min.js: pkg/%.js
@echo Writing $@
@$(UGLIFYJS) --preamble "$$(tools/preamble)" $< >$@

# compile Sass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look great, but we can add the dependencies and get smart recompiling.

sass:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, here, we could list the dependencies after the colon. That way, it will only recompile when necessary.

@echo Compiling Styles
mkdir -p css
@$(SASSC) css/scss/annotator.scss > css/annotator.css

minifyCss:
@echo Minfying Styles
@$(CLEANCSS) --source-map --output css/annotator.min.css css/annotator.css

pkg/annotator.js: browser.js
@mkdir -p pkg/ .deps/
@$(BROWSERIFY) -s annotator $< >$@
Expand Down Expand Up @@ -54,4 +66,4 @@ doc/api/%.rst: src/%.js

-include .deps/*.d

.PHONY: all annotator exts clean test develop doc
.PHONY: all annotator exts sass minifyCss clean test develop doc
Loading