forked from plone/plone.app.mosaic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (38 loc) · 1.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
RJS_CMD = node_modules/requirejs/bin/r.js
LESS_CMD = node_modules/less/bin/lessc
WATCH_CMD = node_modules/watch/cli.js
STATIC = src/plone/app/mosaic/browser/static
SOURCE_JS = build.js $(shell find $(STATIC)/js -name "*.js")
BUNDLE_JS = $(STATIC)/plone-mosaic.js
SOURCE_LESS = $(shell find $(STATIC)/css -name "*.less")
BUNDLE_LESS = $(STATIC)/plone-mosaic.css
CURRENT_DIR = $(shell pwd)
LESS_OPTS = '--modify-var=staticPath="$(CURRENT_DIR)"'
RJS_OPTIONS = paths.pat-logger=$(CURRENT_DIR)/components/patternslib/src/core/logger paths.logging=$(CURRENT_DIR)/components/logging/src/logging
# if mode variable is empty, setting debug build mode
ifeq ($(mode),release)
RJS_ARGS = -o build.js generateSourceMaps=false preserveLicenseComments=true $(RJS_OPTIONS)
else
RJS_ARGS = -o build.js $(RJS_OPTIONS)
endif
all: $(BUNDLE_JS) $(BUNDLE_LESS)
install:
npm install
./node_modules/.bin/bower install
$(BUNDLE_JS): $(SOURCE_JS)
$(RJS_CMD) $(RJS_ARGS)
cp $(BUNDLE_JS) $(BUNDLE_JS).tmp
grep -v sourceMapping $(BUNDLE_JS).tmp > $(BUNDLE_JS)
ifeq ($(mode),release)
else
echo '' >> $(BUNDLE_JS)
grep sourceMapping $(BUNDLE_JS).tmp >> $(BUNDLE_JS)
endif
rm $(BUNDLE_JS).tmp
$(BUNDLE_LESS): $(SOURCE_LESS)
$(LESS_CMD) $(LESS_OPTS) $(STATIC)/css/mosaic.pattern.less > $(BUNDLE_LESS)
watch:
$(WATCH_CMD) make $(STATIC)
clean:
rm -f $(BUNDLE_JS) $(BUNDLE_JS).map $(BUNDLE_LESS)
.PHONY: clean $(RJS_CMD)