-
-
Save dv336699/9013912940126a2858329baf77ac8920 to your computer and use it in GitHub Desktop.
You Don't Know JS Ebooks
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
/* -------------------------------------------------------------- */ | |
/* You don't need to save this file, just use the .sh files below */ | |
body { | |
text-align: justify; | |
} | |
code, pre { | |
font-family: "Hack", monospace; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
text-align: left; | |
} | |
pre { | |
/* Don't make it too dark or it will be harder to read on e-ink devices */ | |
background-color: #f5f5f5; | |
border-radius: 3px; | |
font-size: 0.85em; | |
padding: 10px; | |
text-align: left; | |
/* Wrap the text of pre sections */ | |
white-space: pre-wrap; | |
} | |
@font-face { | |
font-family: "Hack"; | |
src: url(Hack-Regular.ttf) format("truetype"); | |
} |
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
# make sure brew is installed, if not please install it first from https://brew.sh | |
if [ -z "$(which brew)" ]; then | |
echo 'brew not found.' | |
echo 'install from https://brew.sh' | |
exit 1; | |
fi | |
if [ -z "$(which pandoc)" ]; then | |
brew install gnu-sed pandoc wget | |
brew cask install font-hack | |
fi | |
if [ -z "Functional-Light-JS" ]; then | |
git clone https://github.com/getify/Functional-Light-JS.git | |
fi | |
if [ -z "Functional-Light-JS/epub.css" ]; then | |
wget -O Functional-Light-JS/epub.css https://gist.githubusercontent.com/maticrivo/8a2b2845df5081232814b91360ded097/raw/86b62ad3843fa038111021abe2cd16335297eb7f/epub.css | |
fi | |
cd Functional-Light-JS | |
# Clean up redundant headings that end up getting split into separate chapters by themselves | |
find . -iname "*.md" -exec sed -i '/# Functional-Light JavaScript/d' {} \; | |
# Fix <br> tags which pandoc won't convert to <br /> | |
find . -iname "*.md" -exec sed -i 's#<br>#<br />#' {} \; | |
# Close img tags | |
find . -iname "*.md" -exec sed -i -r 's#(<img.*[^/])>#\1 />#' {} \; | |
cd manuscript | |
pandoc -f markdown+smart -o ../"Functional-Light JavaScript.epub" \ | |
--epub-cover-image=images/marketing/front-cover-hd.png \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="Functional-Light JavaScript" \ | |
foreword.md \ | |
preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
ch6.md \ | |
ch7.md \ | |
ch8.md \ | |
ch9.md \ | |
ch10.md \ | |
ch11.md \ | |
apA.md \ | |
apB.md \ | |
apC.md | |
cd .. | |
echo "done" |
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
# make sure brew is installed, if not please install it first from https://brew.sh | |
if [ -z "$(which brew)" ]; then | |
echo 'brew not found.' | |
echo 'install from https://brew.sh' | |
exit 1; | |
fi | |
if [ -z "$(which pandoc)" ]; then | |
brew install gnu-sed pandoc wget | |
brew cask install font-hack | |
fi | |
if [ -z "You-Dont-Know-JS" ]; then | |
git clone https://github.com/getify/You-Dont-Know-JS.git | |
fi | |
if [ -z "You-Dont-Know-JS/epub.css" ]; then | |
wget -O You-Dont-Know-JS/epub.css https://gist.githubusercontent.com/diego-vieira/9013912940126a2858329baf77ac8920/raw/49184004f26d304032867125aca546283132f810/epub.css | |
fi | |
cd You-Dont-Know-JS | |
rm -f *.epub | |
# Clean up redundant headings that end up getting split into separate chapters by themselves | |
find . -iname "*.md" -exec sed -i '/# You Don'\''t Know JS.*/d' {} \; | |
# Fix <br> tags which pandoc won't convert to <br /> | |
find . -iname "*.md" -exec sed -i 's#<br>#<br />#' {} \; | |
# Close img tags | |
find . -iname "*.md" -exec sed -i -r 's#(<img.*[^/])>#\1 />#' {} \; | |
cd up\ \&\ going | |
# --no-highlight is used because syntax highlighting can make reading more difficult on e-ink devices | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 01 - Up and Going.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 01 - Up and Going" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
apA.md | |
cd .. | |
cd scope\ \&\ closures | |
pandoc -f markdown+smart -o foreword.md foreword.html | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 02 - Scope and Closures.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 02 - Scope and Closures" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
apA.md \ | |
apB.md \ | |
apC.md \ | |
apD.md | |
cd .. | |
cd this\ \&\ object\ prototypes | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 03 - this and Object Prototypes.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 03 - this and Object Prototypes" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
ch6.md \ | |
apA.md \ | |
apB.md | |
cd .. | |
cd types\ \&\ grammar | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 04 - Types and Grammar.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 04 - Types and Grammar" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
apA.md \ | |
apB.md | |
cd .. | |
cd async\ \&\ performance | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 05 - Async and Performance.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 05 - Async and Performance" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
ch6.md \ | |
apA.md \ | |
apB.md \ | |
apC.md | |
cd .. | |
cd es6\ \&\ beyond | |
pandoc -f markdown+smart -o ../"You Don't Know JS - 06 - ES6 and Beyond.epub" \ | |
--epub-cover-image=cover.jpg \ | |
--epub-embed-font=$HOME/Library/Fonts/Hack-Regular.ttf \ | |
--css=../epub.css \ | |
-M author="Kyle Simpson" \ | |
-M title="You Don't Know JS - 06 - ES6 and Beyond" \ | |
foreword.md \ | |
../preface.md \ | |
ch1.md \ | |
ch2.md \ | |
ch3.md \ | |
ch4.md \ | |
ch5.md \ | |
ch6.md \ | |
ch7.md \ | |
ch8.md \ | |
apA.md | |
cd .. | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment