ß
Under Construction: The book you’re reading is still under
development. As part of our Beta book program, we’re releasing
this copy well before a normal book would be released. That
way you’re able to get this content a couple of months before
it’s available in finished form, and we’ll get feedback to make
the book even better. The idea is that everyone wins!
Be warned: The book has not had a full technical edit, so it will contain errors.
It has not been copyedited, so it will be full of typos, spelling mistakes, and the
occasional creative piece of grammar. And there’s been no effort spent doing
layout, so you’ll find bad page breaks, over-long code lines, incorrect hyphen-
ation, and all the other ugly things that you wouldn’t expect to see in a finished
book. It also doesn't have an index. We can’t be held liable if you use this book
to try to create a spiffy application and you somehow end up with a strangely
shaped farm implement instead. Despite all this, we think you’ll enjoy it!
Download Updates: Throughout this process you’ll be able to get updated
ebooks from your account at
pragprog.com/my_account
. When the book is com-
plete, you’ll get the final version (and subsequent updates) from the same ad-
dress.
Send us your feedback: In the meantime, we’d appreciate you sending us your
feedback on this book at
pragprog.com/titles/dswdcloj2/errata
, or by using the links
at the bottom of each page.
Thank you for being part of the Pragmatic community!
Dave & Andy
Prepared exclusively for Bob Erb www.allitebooks.com
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in this book, and The Pragmatic
Programmers, LLC was aware of a trademark claim, the designations have been printed in
initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer,
Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trade-
marks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes
no responsibility for errors or omissions, or for damages that may result from the use of
information (including program listings) contained herein.
Our Pragmatic courses, workshops, and other products can help you and your team create
better software and have more fun. For more information, as well as the latest Pragmatic
titles, please visit us at
https://pragprog.com
.
For international rights, please contact
rights@pragprog.com
.
Copyright © 2016 The Pragmatic Programmers, LLC.
All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior consent of the publisher.
Printed in the United States of America.
ISBN-13: 978-1-68050-082-0
Encoded using the finest acid-free high-entropy binary digits.
Book version: B2.0—February 14, 2016
Prepared exclusively for Bob Erb www.allitebooks.com
Contents
Changes in the Beta Releases . . . . . . . . vii
Introduction . . . . . . . . . . . . . ix
1. Getting Your Feet Wet . . . . . . . . . . . 1
Set Up Your Environment 1
Build Your First Web App 3
Refine Your App 8
What You’ve Learned 23
2. Clojure Web Stack . . . . . . . . . . . 25
Route Requests with Ring 26
Extend Ring 32
Define the Routes with Compojure 35
What You’ve Learned 39
3. Luminus Architecture . . . . . . . . . . 41
Manage the Project 41
Think in Terms of Application Components 43
HTML Templating using Selmer 51
What You’ve Learned 58
4. Add ClojureScript . . . . . . . . . . . 61
Understand ClojureScript 61
Configure ClojureScript Support 63
Add ClojureScript Support 63
Build the UI with Reagent 66
What You’ve Learned 79
Prepared exclusively for Bob Erb www.allitebooks.com