Skip to content

Instantly share code, notes, and snippets.

View troch's full-sized avatar

Thomas Roch troch

View GitHub Profile

Keybase proof

I hereby claim:

  • I am troch on github.
  • I am troch (https://keybase.io/troch) on keybase.
  • I have a public key ASCLBbY7TIbTw4SEMCqCuQ93mL86r6PQAaDmQGXBbH3YiQo

To claim this, I am signing this object:

@troch
troch / choosing-a-css-in-js-library.md
Last active October 18, 2020 17:52
Choosing a CSS in JS library

Choosing a CSS in JS library

Check comments below, this is only my opinion and a choice specific to my use case

We've architected a SPA to be universal-ready. It grew a lot, when we introduced code splitting we realised converting to CSS in JS was unavoidable in order to have pre-rendering and not load all our CSS up front. We've procrastinated on looking at CSS in JS properly, prioritasing immediate business needs, but kept an eye on industry evolutions.

Our CSS solution for components was a CSS companion file per component, imported with style / postCSS loader (with webpack) but no CSS modules: we were missing a tighter coupling between component rendering and styles. We were at the bottom of the CSS and componentization ladder, the following links have influenced us in choosing the right solution for us:

@troch
troch / index.js
Created November 28, 2015 17:57
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var element = require('virtual-element');
var deku = require('deku');
var timer = require('deku-timer').default;
function render(component) {
var props = component.props;
return element('div', {}, 'Started ' + props.tick * props.delay + 'ms ago.');
@troch
troch / connect.js
Created November 12, 2015 12:11
Deku connect
import element from 'virtual-element';
import { bindActionCreators } from 'redux';
import shallowEquals from 'is-equal-shallow';
import isPlainObject from 'is-plain-object';
const defaultMapStateToProps = () => ({})
const defaultMapDispatchToProps = dispatch => ({ dispatch })
const defaultMergeProps = (stateProps, dispatchProps, parentProps) => ({
...parentProps,
...stateProps,
@troch
troch / .eslintrc
Last active January 16, 2016 20:25
My ES6 eslint configuration
{
// Parser
"parser": "babel-eslint",
// ECMA Features
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
@troch
troch / Preferences.sublime-settings
Created June 12, 2015 08:49
Sublime Text 3 user preferences
{
"always_prompt_for_file_reload": false,
"color_scheme": "Packages/itg.flat/itg.Monokai.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_options":
[
"subpixel_antialias"
],
"font_size": 10,