-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redo Maketiles to use
export make
(#100)
* `Maketile.{coffee,js}` must `export make` or `export default` rules, though same implicit export rules apply. * Rules are processed recursively and support plain objects, `Map`, `WeakMap`, arrays, and functions. A function's return value is mostly ignored (just tested against `null` to decide whether it defined rule), and should call `svgtiler()` to execute build steps. * Now require Maketile rules to not have `.`s, to avoid accidental infinite recursion with e.g. `(lang) -> svgtiler("mapping.#{lang}")`.
- Loading branch information
Showing
9 changed files
with
168 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default -> | ||
-> | ||
for example in svgtiler.glob '*/' # match directories only | ||
svgtiler [example] | ||
svgtiler [example] # array argument isn't processed for globs etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
for lang in ['css', 'styl'] | ||
exports[lang] = do (lang) -> -> | ||
svgtiler """ | ||
-f css-anim.#{lang} | ||
( shapes.coffee css-anim.csv ) | ||
( ascii.coffee ascii.asc ) | ||
""" | ||
# Supported rules: css (default), styl | ||
|
||
export default exports.css | ||
(lang) -> | ||
lang = 'css' unless lang | ||
svgtiler """ | ||
-f css-anim.#{lang} | ||
( shapes.coffee css-anim.csv ) | ||
( ascii.coffee ascii.asc ) | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
export coffee = -> | ||
coffee: -> | ||
svgtiler '-f map.coffee *.asc' | ||
export js = -> | ||
js: -> | ||
svgtiler '-f map.jsx *.asc' | ||
export graph = -> | ||
graph: -> | ||
svgtiler '-f -O graph-* map.coffee graph.coffee *.asc' | ||
|
||
export default -> | ||
coffee() | ||
js() | ||
graph() | ||
'': -> | ||
svgtiler 'coffee js graph' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
palettes = ['castle', 'overworld', 'underground', 'underwater'] | ||
|
||
## Define individual palette rules and a default rule that builds them all. | ||
for palette in palettes | ||
exports[palette] = do (palette) -> -> | ||
export make = (palette) -> | ||
if palette | ||
svgtiler "-f -s palette=#{palette} -O *_#{palette} mario.coffee door.tsv" | ||
|
||
export default -> | ||
for palette in palettes | ||
exports[palette]() | ||
else | ||
svgtiler palettes | ||
|
||
## Example definition of just the "everything" rule. | ||
export simple = -> | ||
for palette in palettes | ||
svgtiler "-f -s palette=#{palette} -O *_#{palette} mario.coffee door.tsv" | ||
#export make = -> | ||
# for palette in palettes | ||
# svgtiler "-f -s palette=#{palette} -O *_#{palette} mario.coffee door.tsv" | ||
|
||
## Example definition using just a single call to svgtiler() | ||
export singleCall = -> | ||
svgtiler ''' | ||
-f | ||
( -s palette=castle -O *_castle mario.coffee door.tsv ) | ||
( -s palette=overworld -O *_overworld mario.coffee door.tsv ) | ||
( -s palette=underground -O *_underground mario.coffee door.tsv ) | ||
( -s palette=underwater -O *_underwater mario.coffee door.tsv ) | ||
''' | ||
#export make = -> | ||
# svgtiler ''' | ||
# -f | ||
# ( -s palette=castle -O *_castle mario.coffee door.tsv ) | ||
# ( -s palette=overworld -O *_overworld mario.coffee door.tsv ) | ||
# ( -s palette=underground -O *_underground mario.coffee door.tsv ) | ||
# ( -s palette=underwater -O *_underwater mario.coffee door.tsv ) | ||
# ''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Supported rules: cjsx, jsx, coffee | ||
# Default `svgtiler` behavior runs all rules. | ||
|
||
langs = ['cjsx', 'jsx', 'coffee'] | ||
|
||
for lang in langs | ||
exports[lang] = do (lang) -> -> | ||
(lang) -> | ||
if lang | ||
svgtiler "-f outlines.#{lang} *.asc" | ||
|
||
export default -> | ||
for lang in langs | ||
exports[lang]() | ||
else | ||
svgtiler langs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
export txt = -> | ||
txt: -> | ||
svgtiler '-f -P --bg black NES_level7.txt example.asc' | ||
|
||
export coffee = -> | ||
coffee: -> | ||
svgtiler '-f -P NES_level7.coffee example.asc' | ||
|
||
export default -> | ||
txt() | ||
coffee() | ||
'': -> | ||
svgtiler 'txt coffee' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Supported rules: coffee, txt | ||
# Default `svgtiler` behavior runs all rules. | ||
|
||
langs = ['coffee', 'txt'] | ||
|
||
for lang in langs | ||
exports[lang] = do (lang) -> -> | ||
export make = (lang) -> | ||
if lang | ||
svgtiler "-f --tw 50 --th 50 tilt.#{lang} *.asc *.csv" | ||
|
||
export default -> | ||
for lang in langs | ||
exports[lang]() | ||
else | ||
svgtiler langs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters