Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A static website with React? Really?

A static website with React? Really?

Imagine you need a static website for a small website, a documentation or a corporate website. Why a static website? Because static is the new dynamic. It’s unhackable. It’s performant. And it has more to offer than you can imagine. But the thing is: you work with the React ecosystem and CSS Modules everyday and don’t want to write boring HTML templates and dangerous CSS selectors. You are a modern front-end developer and you don't really want to install Ruby or Python to build silly static HTML pages. You just want to use the tools you've grown to love. You want to get the same DX (developer experience) that React ecosystem offers you on a daily basis. You want to enjoy hot loading while you will work on your website. What if I told you that you could reuse all the unit tested React components that you will find on npm to make your isomorphic/universal static website? What if I told you that this website will be static but dynamic at the same time? What if I told you that you can even offer the UX of a progressive web app?

VIDEO AVAILABLE HERE https://vimeo.com/168480208

Maxime Thirouin

May 25, 2016
Tweet

More Decks by Maxime Thirouin

Other Decks in Technology

Transcript

  1. @MoOx 4 Let’s say you need a website. Personal website,

    documentation, corporate website etc
  2. @MoOx 5 Wordpress and Drupal are the most used CMS.

    “WordPress powers 25% of the internet”
  3. @MoOx 15 Client Server → ← 90’s model Browsers are

    document readers. Every interaction happen on the server.
  4. @MoOx 29 1. Content 2. Templates 3. Build step 4.

    Deploy step Developer / Publisher
  5. @MoOx 30 User Experience 1. Request 2. Builded content from

    CDN 3. (Enhancement from external APIs)
  6. @MoOx 36 Lot’s of websites are hybrid. Enhanced with JavaScript.

    Usage of APIs for some parts Usage of third party services.
  7. @MoOx 37 SPA are not SPA anymore. Respond to URLs,

    good browser history, pre-rendering… And,
  8. @MoOx 39 The JAM stack is the modern way for

    building websites and apps.
  9. @MoOx 42 • No more expensive dynamic servers • Focused

    on front-end hosted on a CDN • Use APIs for any moving parts. It's the fastest growing new stack for building websites and apps The JAM stack is the stack for this new reality. Instead of FTPing server-side code to a shared server, we push to git and our code is instantly built and distributed onto CDN nodes across the world. Instead of depending on a database for every request we serve, we use build tools to ship full sites and apps ready to run directly in the browser. Instead of mixing persistence, HTML generation, credit-card transactions, authentication, etc, all together, we separate these concerns and consume well defined APIs from our front-end.
  10. @MoOx 49 { "name": "JAMStack", "version": "1.0.0", "description": "The website

    for jamstack.org", "main": "gulpfile.js", "scripts": { "build": "./node_modules/.bin/gulp build", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "MIT", "dependencies": { "gulp": "^3.9.1", "gulp-front-matter": "^1.3.0", "gulp-layout": "0.0.3", "gulp-markdown": "^1.2.0", "jade": "^1.11.0" } } https://github.com/jamstack/jamstack.org/blob/master/package.json
  11. @MoOx 57 Text is error prone. We are human, we

    make mistakes. Handlebars and friends allow us to produce wrong HTML.
  12. @MoOx 58 And even if your HTML is correct, you

    need to sync it with your JavaScript that will enhance the UX.
  13. @MoOx 62 Template > 1 language Text > 1 language

    Data > 1 language Back-end > 1 language + 1 package manager Front-end > 1 language + 1 package manager Most static website generator stack
  14. @MoOx 63 Template > 1 language Text > 1 language

    Data > 1 language Back-end > 1 language + 1 package manager Front-end > 1 language + 1 package manager Most static website generator stack
  15. @MoOx 69 1. You work with the React ecosystem and

    CSS Modules everyday and don’t want to write boring HTML templates and dangerous CSS selectors. 2. You are a modern front-end developer and you don't really want to install Ruby or Python to build silly static HTML pages. 3. You just want to use the tools you've grown to love. You want to get the same DX (developer experience) that React ecosystem offers you on a daily basis. You want to enjoy hot loading while you will work on your website.
  16. @MoOx 70 What if I told you that you could

    reuse all the unit tested React components that you will find on npm to make your isomorphic/universal static website? What if I told you that this website will be static but dynamic at the same time? What if I told you that you can even offer the UX of a progressive web app?
  17. @MoOx 76 Programming > JavaScript (node, browser) + npm Text

    > 1 language of your choice (default to Markdown) Data > 1 language of your choice (JSON, Yaml…) Simple and Flexible
  18. @MoOx 77 You can just grab some packages on the

    npm ecosystem to help you build your website, blog or even a small app. React and npm ecosystem
  19. @MoOx 78 Isomorphic/Universal by default. All pages are available as

    HTML (works with no JavaScript) but user can get an enhanced navigation (when JavaScript is on).
  20. @MoOx 80 Live-edit for content, layouts and any UI elements

    thanks to React Hot Loader. Visual errors. Setup and start in few minutes Awesome DX
  21. @MoOx 81 1 command to setup a website or webapp

    in a minute. 1 command to write and develop. 1 command to build, optimise and publish (static files). Awesome DX
  22. @MoOx 83 Modern syntax (ES2015 and more via Babel, PostCSS

    / cssnext) CSS Modules Strong linting rules for JS (ESLint) and CSS (Stylelint) No global npm package required Good defaults
  23. @MoOx 84 Full control (on almost anything) Any text engine

    accepted (default to markdown) Normal Webpack configuration React-Router routes Freedom
  24. @MoOx 85 Current Roadmap [WIP] Pre-render all routes (eg: tags

    & categories pages) [WIP] Pagination Built-in Search and easy way to use third party like Algolia Minimalist Admin
  25. @MoOx 86 One more thing… In a very near future,

    you will be able to use Phenomic without static content, just to pre-render your routes as App Shell.