- View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
- View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
- HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
- String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
| :root { | |
| --ease-in-quad: cubic-bezier(.55, .085, .68, .53); | |
| --ease-in-cubic: cubic-bezier(.550, .055, .675, .19); | |
| --ease-in-quart: cubic-bezier(.895, .03, .685, .22); | |
| --ease-in-quint: cubic-bezier(.755, .05, .855, .06); | |
| --ease-in-expo: cubic-bezier(.95, .05, .795, .035); | |
| --ease-in-circ: cubic-bezier(.6, .04, .98, .335); | |
| --ease-out-quad: cubic-bezier(.25, .46, .45, .94); | |
| --ease-out-cubic: cubic-bezier(.215, .61, .355, 1); |
| 'use strict'; | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var del = require('del'); | |
| var debug = require('gulp-debug'); | |
| var $ = require('gulp-load-plugins')(); | |
| gulp.task('clean:pages', function() { | |
| gutil.log('Deleting /pages/**/*', gutil.colors.magenta('123')); | |
| return del([ |
| {% macro img(file, base, caption="", sizes="100vw") %} | |
| {% set filename = file|split('.') %} | |
| {% set filenameext = "." ~ filename|last %} | |
| {% set file = file|replace({(filenameext): ""}) %} | |
| <img | |
| src="{{ base }}/{{ file }}-320{{ filenameext }}" | |
| srcset="{{ base }}/{{ file }}-320{{ filenameext }} 320w, | |
| {{ base }}/{{ file }}-480{{ filenameext }} 480w, | |
| {{ base }}/{{ file }}-640{{ filenameext }} 640w, | |
| {{ base }}/{{ file }}-960{{ filenameext }} 960w, |
These are my notes basically. At first i created this gist just as a reminder for myself. But feel free to use this for your project as a starting point. If you have questions you can find me on twitter @thomasf https://twitter.com/thomasf This is how i used it on a Debian Wheezy testing (https://www.debian.org/releases/testing/)
Discuss, ask questions, etc. here https://news.ycombinator.com/item?id=7445545
| // | |
| // Golden Ratio Typography | |
| // -------------------------------------------------- | |
| // Golden Ratio Math | |
| // | |
| // Let's do some math so we can build beautiful typography and vertical rhythm. | |
| // For any magic to happen, set the $ContentWidth variable on _variables.scss | |
| // to match your content box width (normally this is 640px, 740px, etc...). |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
| <script src="v2p.js"></script> | |
| <style type="text/css" media="all"> | |
| body { margin: 0; } | |
| div { | |
| background: #fa7098; | |
| } |
- Avoid too many reflows (the browser to recalculate everything)
- Use advanced CSS3 for graphic card rendering
- Precalculate sizes and positions
The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows: