Skip to content

Commit 98c3a81

Browse files
committed
Add makefile target to publish package, examples/ is .npmignored
1 parent 935ad80 commit 98c3a81

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Head over to [https://github.com/gruntjs/grunt-contrib-watch](https://github.com
133133

134134
### Using make
135135

136-
See `examples/tinylr.mk`.
136+
See [`tinylr.mk`](./tinylr.mk) file.
137137

138138
Include this file into your project Makefile to bring in the following targets:
139139

@@ -149,7 +149,7 @@ CSS_DIR = app/styles
149149
CSS_FILES = $(shell find $(CSS_DIR) -name '*.css')
150150

151151
# include the livereload targets
152-
include node_modules/examples/tinylr.mk
152+
include node_modules/tiny-lr/tinylr.mk
153153

154154
$(CSS_DIR): $(CSS_FILES)
155155
@echo CSS files changed: $?

tinylr.mk

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Include this file into your makefile to bring in the following targets:
2+
#
3+
# - start - Start the LiveReload server
4+
# - stop - Stops the LiveReload server
5+
# - livereload - alias to start
6+
# - livereload-stop - aias to stop
7+
#
8+
# Then define your "empty" targets, and the list of files you want to monitor.
9+
#
10+
# CSS_DIR = app/styles
11+
# CSS_FILES = $(shell find $(CSS_DIR) -name '*.css')
12+
#
13+
# $(CSS_DIR): $(CSS_FILES)
14+
# @echo CSS files changed: $?
15+
# @touch $@
16+
# curl -X POST http://localhost:35729/changed -d '{ "files": "$?" }'
17+
#
18+
# reload-css: livereload $(CSS_DIR)
19+
#
20+
# .PHONY: reload-css
21+
#
22+
# The pattern is always the same, define a target for your root directory that
23+
# triggers a POST request and `touch` the directory to update its mtime, a
24+
# reload target with `livereload` target and the list of files to "watch" as
25+
# prerequisites
26+
#
27+
# You can chain multiple "reload" targets in a single one:
28+
#
29+
# reload: reload-js reload-css reload-img reload-EVERYTHING
30+
31+
# add tiny-lr to your PATH (only affect the Makefile environment)
32+
PATH := ./node_modules/.bin:$(PATH)
33+
34+
tiny-lr.pid:
35+
@echo ... Starting server, running in background ...
36+
@echo ... Run: "make stop" to stop the server ...
37+
@tiny-lr &
38+
39+
start: tiny-lr.pid
40+
41+
stop:
42+
@[ -a tiny-lr.pid ] && curl http://localhost:35729/kill
43+
# Or: @[ -a tiny-lr.pid ] && kill $(shell cat tiny-lr.pid)
44+
45+
livereload: start
46+
livereload-stop: stop
47+
48+
49+
.PHONY: start stop livereload livereload-stop

0 commit comments

Comments
 (0)