Skip to content

Instantly share code, notes, and snippets.

Sebastien Hiticas sbtnh

View GitHub Profile
@troch
troch / choosing-a-css-in-js-library.md
Last active May 19, 2020
Choosing a CSS in JS library
View choosing-a-css-in-js-library.md

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:

@excalq
excalq / gist:2961415
Created Jun 20, 2012
Javacript: Set or Update a URL/QueryString Parameter, and update URL using HTML history.replaceState()
View gist:2961415
// Explicitly save/update a url parameter using HTML5's replaceState().
function updateQueryStringParam(param, value) {
baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
urlQueryString = document.location.search;
var newParam = key + '=' + value,
params = '?' + newParam;
// If the "search" string exists, then build params from it
if (urlQueryString) {
keyRegex = new RegExp('([\?&])' + key + '[^&]*');
You can’t perform that action at this time.