FrontEnd Optimization Tools
Delay | User reaction |
---|---|
0-100ms | Instant |
100-300ms | Feels sluggish |
300-1000ms | Machine is working... |
1 s+ | Mental switch |
10s+ | I'll come back later |
Request size
Request number
Ensures code style in dev team
Prevents common mistakes
Guarantees minimum quality
Reduce project code/size
Free your project from vendor code
Manage dependencies
Code in your favourite JS flavour
Use bleeding Edge features
Use improved language
Concat code
Concat images
Cache
Speeds up develop time
Reduce mistakes
Focus on things that matters
Integrate soon and often
Run automated jobs
Generate reports
Communicate results
Automate repetitive tasks
Speedup development process
Focus on things that matters
Automation tools
Node based
Community support
Tons of plugins
Install
Setup
Run task
grunt install grunt-contrib-concat --save-dev
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
grunt.initConfig({
concat: {
js: {
src: ['src/app/**/*.js'],
dest: 'dist'
}
}
});
});
grunt concat:js
grunt.registerTask('serve', 'Task description', function(target) {
if (target === 'dist' || grunt.option('custom') === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'wiredep',
'ngconstant',
'includeSource:server',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt serve
grunt serve:dist
grunt serve --custom=dist
task name
task param
sub tasks
task param
task option
task name
task option
Test isolated componentes/modules
Boundary Test Cases
Mock/stub dependencies
Test collaboration between componentes/modules
Functional documentation
Sinon.js
Simulates user interaction
Tests user functionalities
Checks whole system
Develop a e2e login test