aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--Makefile10
-rwxr-xr-xbin/generate-dependencies12
3 files changed, 26 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 2d7ed77..c1db7a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,11 @@
1grilist.conf 1grilist.conf
2node_modules/
3
4#Autogenerierte Dateien beim Build
2package.json 5package.json
3.npm_update 6.npm_update
4node_modules/ 7*.d
8
9#Gebuildete Dateien
5assets/* 10assets/*
6 11
diff --git a/Makefile b/Makefile
index 43b5fd9..269e68e 100644
--- a/Makefile
+++ b/Makefile
@@ -3,11 +3,12 @@ include config.mk
3CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css')) 3CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css'))
4LESS_FILES = $(patsubst assets_src/%.less, assets/%.css, $(shell find assets_src/css/ -type f -name '*.less')) 4LESS_FILES = $(patsubst assets_src/%.less, assets/%.css, $(shell find assets_src/css/ -type f -name '*.less'))
5JS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js')) 5JS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js'))
6DEPFILES = $(patsubst assets/%, assets_src/%, $(JS_FILES:.js=.d))
6 7
7BROWSERIFY := ./node_modules/browserify/bin/cmd.js 8BROWSERIFY := ./node_modules/browserify/bin/cmd.js
8LESSC := ./node_modules/less/bin/lessc 9LESSC := ./node_modules/less/bin/lessc
9 10
10rewrite_imports = "s/(require\([\"'])lib/\1.\/lib/g" 11-include $(DEPFILES)
11 12
12all: .npm_update $(CSS_FILES) $(LESS_FILES) $(JS_FILES) 13all: .npm_update $(CSS_FILES) $(LESS_FILES) $(JS_FILES)
13 14
@@ -15,6 +16,7 @@ print_info:
15 @echo $(CSS_FILES) 16 @echo $(CSS_FILES)
16 @echo $(LESS_FILES) 17 @echo $(LESS_FILES)
17 @echo $(JS_FILES) 18 @echo $(JS_FILES)
19 @echo $(DEPFILES)
18 20
19.npm_update: package.json 21.npm_update: package.json
20 touch $@ 22 touch $@
@@ -34,7 +36,10 @@ assets/css/%.css: assets_src/css/%.less
34 @echo lessc $< > $@ 36 @echo lessc $< > $@
35 @$(LESSC) $< > $@ 37 @$(LESSC) $< > $@
36 38
37assets/js/%.js: assets_src/js/%.js .babelrc 39assets_src/js/%.d: assets_src/js/%.js
40 @./bin/generate-dependencies $(patsubst assets_src/%, assets/%, $<) $< $@
41
42assets/js/%.js: assets_src/js/%.js assets_src/js/%.d .babelrc
38 @echo browserify $< -o $@ 43 @echo browserify $< -o $@
39 @$(BROWSERIFY) --debug $< -o $@ -t babelify 44 @$(BROWSERIFY) --debug $< -o $@ -t babelify
40 45
@@ -42,6 +47,7 @@ clean:
42 -rm -- $(CSS_FILES) 47 -rm -- $(CSS_FILES)
43 -rm -- $(LESS_FILES) 48 -rm -- $(LESS_FILES)
44 -rm -- $(JS_FILES) 49 -rm -- $(JS_FILES)
50 -rm -- $(DEPFILES)
45 51
46superclean: clean 52superclean: clean
47 -rm -- .npm_last_update 53 -rm -- .npm_last_update
diff --git a/bin/generate-dependencies b/bin/generate-dependencies
new file mode 100755
index 0000000..937412e
--- /dev/null
+++ b/bin/generate-dependencies
@@ -0,0 +1,12 @@
1#!/bin/bash
2{
3 path="${2%/*}"
4 echo -n "$1: $2 "
5 deps=`grep import "$2" | grep -Po "['\"]\./.*?['\"]" | sed 's/.\(.*\)./\1/'`
6 for dep in $deps; do
7 echo -n "$path/$dep.js "
8 done
9 echo -n '
10
11'
12} > "$3"