Disclaimer!
This is only one approach, there's many others.
The web is moving fast.
There's a bazillion things to learn.
We can't learn everything.
Don't Panic.
Things I find helpful
Dotfiles - Tutsplus tutorial
Version Control
Tooling
Working Locally
Improving With Each Project
Local Development Environment
### $ in Terminal
$ is the default character you'll see, in the examples going forward you don't need to paste this in.
It's also possible to customise the $, for example.
.bash_prompt
```bash
PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]
$(basename "$(dirname "$PWD")")/\W\[\a\]${BOLD}\
$(usernamehost)\[$GREEN\]\w\$(git_info)\[$WHITE\]
\n\n༼ つ ◕_◕ ༽つ \[$RESET\]"
```
![nodollar](http://173.254.28.140/~simonow1/speaking/mcrfred15/nodollar.png)
https://github.com/s10wen/dotfiles/blob/master/.bash_prompt#L57
### Create a new site folder
```
$ mkd sitename.dev
```
Custom .functions code
```bash
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
```
I just created a new directory
&&
I'm in it!
One time installs
Node
http://nodejs.org/
Yeoman, Bower and Grunt
$ npm install -g yo
# For npm versions < 1.2.10.
$ npm install -g grunt-cli bower
Ok, but why?
Unicorns and rainbows await. Bear with me.
npm = package.json
bower = bower.json
grunt = Gruntfile.js
### npm = package.json
```
{
"name": "mind-co-uk",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
...
"grunt-contrib-compress": "~0.7.0"
},
"engines": {
"node": ">=0.8.0"
}
}
```
### bower = bower.json
```
{
"name": "mind-co-uk",
"version": "0.0.0",
"dependencies": {
"sass-bootstrap": "~3.0.0",
...
"respond": "~1.4.2"
},
"devDependencies": {}
}
```
### grunt = Gruntfile.js
```
// Generated on 2014-01-13 using generator-webapp 0.4.4
'use strict';
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// configurable paths
yeoman: {
app: 'app',
dist: 'dist/2013'
},
...
'cssmin',
'uglify',
'copy:dist',
'imagemin:svgDir',
'usemin',
'copy:redirect',
'copy:robots',
'copy:sitemap'
]);
grunt.registerTask('default', [
'test',
'build'
]);
};
```
Git / GitHub / BitBucket
### Now for the good bit
```
$ npm install && bower install && grunt serve
```
Let's Install Something
Say we want html5shiv...
Search Google
Find it
Download it
Move to our project
Include a link to it
Right?
Search
$ bower search html5
Install
$ bower install html5shiv --save
What did that do then?
Not only has that now pulled in html5shiv to our project.
It's also saved it into the `bower.json` file.
So next time when we do `$ bower install` it automatically installs.
### Add to a grunt comment
```bash
<!-- build:js scripts/vendor.js -->
<script src="bower_components/all/the.js"/>
<script src="bower_components/awesome/bower.js"/>
<script src="bower_components/scripts/that.js"/>
<script src="bower_components/you/want.js"/>
<!-- endbuild -->
```
### 2 other important files
.editorconfig
Ensure consistency throughout your team.
```
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = LF
trim_trailing_whitespace = true
[{package.json,bower.json}]
indent_style = space
indent_size = 2
```
### 2 other important files
.gitignore
Don't add files to your theme repo you don't need to.
```
### Package Managed ###
/node_modules
/bower_components
### CSS ###
.sass-cache
/css/screen.css
/css/screen.css.map
```
### Sublime Superpowers
Preferences > Settings - User
```
{
"color_scheme": "Packages/Color Scheme - Default/Monokai-Phoenix.tmTheme",
"default_encoding": "UTF-8",
"detect_indentation": false,
"draw_white_space": "all",
"file_exclude_patterns":
[
".DS_Store",
"Desktop.ini",
"*.pyc",
"._*",
"Thumbs.db",
".Spotlight-V100",
".Trashes",
"*.scssc"
],
"folder_exclude_patterns":
[
".git",
"node_modules"
],
"font_size": 12,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"match_brackets": true,
"match_brackets_angle": true,
"show_encoding": true,
"show_line_endings": true,
"ensure_newline_at_eof_on_save": true,
"tab_completion": false,
"tab_size": 4,
"theme": "Phoenix Dark.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": true
}
```
### Sublime Superpowers
Preferences > Key Bindings - User
```
[
{ "keys": ["ctrl+shift+t"], "command": "delete_trailing_spaces" },
{ "keys": ["super+b"], "command": "toggle_side_bar" },
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }
]
```
![trailing-whitespace](http://173.254.28.140/~simonow1/speaking/mcrfred15/trailing-whitespace.png)
### Sublime Superpowers
Packages
https://sublime.wbond.net/installation
`Cmd+Shift+P` > ip > Package Control: Install Package
Some of my favourite http://sow.so/st
### Sublime Text - Config Project
```
httpd.conf, httpd-vhosts.conf, hosts
```
Project > Save Project As...
Quick Switch project = `Ctrl+Cmd+P`
http://sow.so/paths
### hosts
```
# S
127.0.0.1 sitename.dev
```
### httpd-vhosts.conf
```
# S
# sitename.com
<VirtualHost *:80>
ServerName sitename.dev
ServerAlias *.sitename.dev
DocumentRoot "/Users/simonowen/Sites/sitename.dev/"
<Directory "/Users/simonowen/Sites/sitename.dev/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
ErrorLog "/var/log/apache2/mysite.local-error_log"
</VirtualHost>
```
More time savers
# List all files colorized in long format
alias l="ls -l ${colorflag}"
# Open current directory in Sublime Text
alias s="subl ."
Cmd+T > Start typing out a filename > Enter
Styling with Sass
With grunt watch
, grunt will watch for changes and livereload will update the browser.
With Sass it's possible to split code up into separate files called partials.
Live Reload Styling
VIDEO
Power Tools
Alfred
VIDEO
Quickly get to the app you're after.
First Idea
Highlighted potential issues.
Fixed dimensions
Maintainability
Responsive Issues
Device Issues
Screenreaders
ajaxInclude
ajaxInclude (thanks @stucox )
Easier to maintain
No page blocking
Full CSS control
<div id="svg-clock" data-replace="svg/clock.html"></div>
SVG Issue
SVG Issue
SVG Viewbox
<svg viewBox="0 0 358 414">
Grunt Build SVG Tag Issue
Illustrator / SVG coordinates
Finished Result
VIDEO
With random animation on page load
Browser Testing
Animation Testing Required
Getting clicky with pointer events
VIDEO
Gradient Rendering
Win7 Chrome Width Issue
IE8
IE8
IE8
IE8
IE8
IE8
IE8
IE8
Device Testing
Horizontal Scrolling
Can we make the woman get pregnant?
60fps makes me super happy
Build Tool Performance - App - 6.282s
Build Tool Performance - Dist - 4.726s
AWS S3 Deployment as easy as:
$ s3_website push --site dist
Facebook Social
Facebook Social
Crazy Egg
This makes me happy...
To everyone that left a comment and shared a link.
Thank you!