A page on the WWW typically (but not always) consists of three components:
You could also have a “page” that is just a text file, or XML, or whatever. We won’t really consider that.
"page" === HTML
function favoritePies(id, data) { var width = 600, height = 200; var color = d3.scale.category10(); var svg = d3.select(id) .append("svg") .attr("width", width) .attr("height", height); var x = d3.scale.linear() .domain([0, data.length]) .range([0, width]); }
body { padding-top: 50px; } .greeting { padding: 40px 15px; text-align: center; } #content { margin: auto; }
Your CSS and JS could be included inside the <head>
or <body>
elements of your HTML file. However, this is considered bad practice.
Keep your data separate from your style and your business logic. (For the most part).
To do this, we will let our HTML document link to external CSS stylesheets and Javascript files. To do that we use:
<link>
for CSS
<script>
for JS
When you browse the web, your browser (and computer) go through a complex life cycle to serve your page.
A simple overview:
<img>
) (Non-blocking).A static asset is any document (HTML, JS, CSS, image, etc) that does not change often and should be the same for all users. This is important for caching.
Your browser and external servers will cache for you.
Static doesn’t mean non-interactive! It just means we serve the same content to everyone. We can still use Javascript to make slick UIs.
On the other hand, dynamic or non-static sites are generated on the fly based on your request.
Why does this matter?
Your javascript libraries (D3, Underscore, jQuery, etc) and CSS (Bootstrap) are readily available, and included in our workbook template.
Controller: python app.py
Do this every time before you add an exercise:
git fetch release
git checkout master
git merge release/master
Do this after every working session:
git status
git add FILENAME
git commit -m "USEFUL MESSAGE"
git push origin master
Come to class EVERY TIME
Bring your laptop EVERY TIME