Before
Using MVP frameworks - PHP Symfony, Nette, Laravel, Wordpress
Non static websites - web frontend dependent of backend
Web frontend as a part of backend - only templates, no possibility of code
reusing, no flexibility
Slow performance
Hard build and deploy process - installing packages for whole system
Now
Simple Scalability - few files hosted even on different server, focus on my
application - not whole infrastructure
Communication via API
Modularity - more suitables technologies for different problems
Increased Flexibility - using API for web, mobile app, public expose
Separate build and deploy
Who will win? Client’s wish,
common sense or our pride?
Web frontend is independent -> huge market of frameworks & libs
Constant changes or hard resets on dev stacks
Build app on unsuitable technology
Requirements
Client app - fetching data from API, loading data once (mobile app base),
temporary saving data, custom responsive layout, SEO
Requirements
Client app - fetching data from API, loading data once (mobile app base),
temporary saving data, custom responsive layout, SEO
Prepared packages
Static websites - pure HTML, SASS, JS
Static websites with support of multiple languages or dynamic elements or
SEO - Middleman generator of static sites
Dynamic websites with fast communication with API - React (server
rendering for seo), Webpack
Nonpublic administration (internal) systems - React, Webpack, Redux
Chosen heroes
React - Layout, Components, App structure, Server-rendering (microsite)
Fetch API - Getting data from API
Redux - Data flow, App state
Sass - CSS preprocessor, design
Managing data
stop using carcinogenic CALLBACKS
button -> click ->wait for callback ….. confusion
NOW -> unidirectional data flow -> button -> click -> make action ->
change application state -> components reload
CSS before
Huge files
No code reusing
Non-objective
No flexibility - change color of app - change on 100 lines
—> use CSS preprocessors - Less, Sass, Stylus
Building the web app
Transpiling to browser language - from JSX, ES6 …
Translate Sass files to CSS files
Livereloading - realtime watching for changes and reloading app
Different data for development and production
Tools: Gulp, Grunt, Webpack
module bundler
dependency graph -> bundles
-> browser can load it
building
watching
transpiling
extracting
minifying
uglyfying
livereload support
development vs. production
Webpack