Skip to content

Commit b2e760c

Browse files
committed
Document client-side bundling tools
Since there are a few of these now and it's a common use case, might as well start writing them down.
1 parent be77679 commit b2e760c

File tree

2 files changed

+50
-33
lines changed

2 files changed

+50
-33
lines changed

doc/bundling.markdown

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Eslisp and client-side bundling tools
2+
3+
## Webpack
4+
5+
See [eslisp-loader][1].
6+
7+
## Browserify
8+
9+
With [eslispify][2]: `-t eslispify`
10+
11+
With [anyify][3]: `-t [ anyify --esl [ eslisp ] ]`
12+
13+
[1]: https://github.com/Paraknight/eslisp-loader
14+
[2]: https://github.com/terinjokes/eslispify
15+
[3]: https://github.com/quarterto/Anyify

readme.markdown

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ Further documentation in [`doc/`][25]:
9191
- [Module packaging and distribution tutorial][28]
9292
- [Comparison against other JS-lisps][29]
9393
- [Using source maps][30]
94+
- [Using with client-side bundling tools][31]
9495

9596
## Brief tutorial
9697

97-
This is a quick overview of the core language. See [the basics reference][31]
98-
or the [test suite][32] for a more complete document.
98+
This is a quick overview of the core language. See [the basics reference][32]
99+
or the [test suite][33] for a more complete document.
99100

100101
### Building blocks
101102

@@ -145,7 +146,7 @@ arguments as the rest:
145146
a.b[5].c['yo'];
146147
1 + 2;
147148

148-
If the `(. a b)` syntax feels tedious, you might like the [eslisp-propertify][33] transform macro, which lets you write `a.b` instead.
149+
If the `(. a b)` syntax feels tedious, you might like the [eslisp-propertify][34] transform macro, which lets you write `a.b` instead.
149150

150151
If the first element of a list isn't the name of a macro which is in scope, it
151152
compiles to a function call:
@@ -265,7 +266,7 @@ Macros are functions that run at compile-time. Whatever they return becomes
265266
part of the compiled code. User-defined macros and pre-defined compiler ones
266267
are treated equivalently.
267268

268-
**There's a [fuller tutorial to eslisp macros in the `doc/` directory][34].**
269+
**There's a [fuller tutorial to eslisp macros in the `doc/` directory][35].**
269270
These are just some highlights.
270271

271272
You can alias macros to names you find convenient, or mask any you don't want
@@ -286,7 +287,7 @@ to use.
286287
[1];
287288
array(1);
288289

289-
Macros can use [`quasiquote`][35] (`` ` ``), `unquote` (`,`) and
290+
Macros can use [`quasiquote`][36] (`` ` ``), `unquote` (`,`) and
290291
`unquote-splicing` (`,@`) to construct their outputs neatly.
291292

292293
<!-- !test in macro and call -->
@@ -348,7 +349,7 @@ compilation side-effects and conditional compilation.
348349

349350
Because macros are JS functions and JS functions can be closures, you can even
350351
make macros that share state. One way is to put them in an
351-
[immediately-invoked function expression (IIFE)][36], return them in an object,
352+
[immediately-invoked function expression (IIFE)][37], return them in an object,
352353
and pass that to `macro`. Each property of the object is imported as a macro,
353354
and the variables in the IIFE are shared between them.
354355

@@ -386,9 +387,9 @@ whatever, so you can put the macro function in a separate file and do—
386387

387388
—to use it.
388389

389-
This means you can publish eslisp macros on [npm][37]. The name prefix
390+
This means you can publish eslisp macros on [npm][38]. The name prefix
390391
`eslisp-` and keyword `eslisp-macro` are recommended. [Some exist
391-
already.][38]
392+
already.][39]
392393

393394
### Transformation macros
394395

@@ -398,18 +399,18 @@ argument (`-t` for short). For example,
398399

399400
eslc --transform eslisp-propertify myprogram.esl
400401

401-
uses [eslisp-propertify][39] to convert all atoms containg dots into member
402+
uses [eslisp-propertify][40] to convert all atoms containg dots into member
402403
expressions. The flag can be specified multiple times.
403404

404405
## Try it
405406

406407
### Global install
407408

408-
If you want `eslc` in your [`$PATH`][40], `npm install --global eslisp`. (You
409+
If you want `eslc` in your [`$PATH`][41], `npm install --global eslisp`. (You
409410
might need `sudo`.) Then `eslc` program takes eslisp code as input and outputs
410411
JavaScript.
411412

412-
The compiler runs as a [REPL][41] if given no arguments, though it doesn't
413+
The compiler runs as a [REPL][42] if given no arguments, though it doesn't
413414
(yet) support macros in that mode.
414415

415416
You can also just pipe data to it to compile it if you want.
@@ -431,21 +432,21 @@ it sees them.
431432
## How does it work
432433

433434
In brief: A table of predefined macros is used to turn S-expressions into
434-
[SpiderMonkey AST][42], which is fed to [escodegen][43], which outputs JS.
435+
[SpiderMonkey AST][43], which is fed to [escodegen][44], which outputs JS.
435436
Some of those macros allow defining further macros, which get added to the
436437
table and work from then on like the predefined ones.
437438

438-
For more, read [the source][44]. Ask questions!
439+
For more, read [the source][45]. Ask questions!
439440

440441
## Bugs, discussion & contributing
441442

442-
Create a [github issue][45], or say hi [in gitter chat][46].
443+
Create a [github issue][46], or say hi [in gitter chat][47].
443444

444-
I'll assume your contributions to also be under the [ISC license][47].
445+
I'll assume your contributions to also be under the [ISC license][48].
445446

446447
## License
447448

448-
[ISC][48].
449+
[ISC][49].
449450

450451
[1]: https://www.npmjs.com/package/eslisp
451452
[2]: https://travis-ci.org/anko/eslisp
@@ -477,21 +478,22 @@ I'll assume your contributions to also be under the [ISC license][47].
477478
[28]: doc/ditributing-modules.markdown
478479
[29]: doc/comparison-to-other-js-lisps.markdown
479480
[30]: doc/source-maps.markdown
480-
[31]: doc/basics-reference.markdown
481-
[32]: test.ls
482-
[33]: https://www.npmjs.com/package/eslisp-propertify
483-
[34]: doc/how-macros-work.markdown
484-
[35]: http://axisofeval.blogspot.co.uk/2013/04/a-quasiquote-i-can-understand.html
485-
[36]: https://en.wikipedia.org/wiki/Immediately-invoked_function_expression
486-
[37]: https://www.npmjs.com/
487-
[38]: https://www.npmjs.com/search?q=eslisp-
488-
[39]: https://www.npmjs.com/package/eslisp-propertify
489-
[40]: http://en.wikipedia.org/wiki/PATH_(variable)
490-
[41]: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
491-
[42]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
492-
[43]: https://github.com/estools/escodegen
493-
[44]: src/
494-
[45]: https://github.com/anko/eslisp/issues/new
495-
[46]: https://gitter.im/anko/eslisp
496-
[47]: http://opensource.org/licenses/ISC
481+
[31]: doc/bundling.markdown
482+
[32]: doc/basics-reference.markdown
483+
[33]: test.ls
484+
[34]: https://www.npmjs.com/package/eslisp-propertify
485+
[35]: doc/how-macros-work.markdown
486+
[36]: http://axisofeval.blogspot.co.uk/2013/04/a-quasiquote-i-can-understand.html
487+
[37]: https://en.wikipedia.org/wiki/Immediately-invoked_function_expression
488+
[38]: https://www.npmjs.com/
489+
[39]: https://www.npmjs.com/search?q=eslisp-
490+
[40]: https://www.npmjs.com/package/eslisp-propertify
491+
[41]: http://en.wikipedia.org/wiki/PATH_(variable)
492+
[42]: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
493+
[43]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
494+
[44]: https://github.com/estools/escodegen
495+
[45]: src/
496+
[46]: https://github.com/anko/eslisp/issues/new
497+
[47]: https://gitter.im/anko/eslisp
497498
[48]: http://opensource.org/licenses/ISC
499+
[49]: http://opensource.org/licenses/ISC

0 commit comments

Comments
 (0)