Skip to content

Instantly share code, notes, and snippets.

@sbusch
sbusch / _HOWTO produce namespaced ant-design CSS.md
Last active May 9, 2022 05:34
Prefix all rules of a CSS file with custom class (= create a namespace), required for antd (Ant Design)

How to produce a reliable ant-design CSS with all rules prefixed ("namespaced")

I wrote this to add a prefix to all antd style rules (or any other external CSS files). It is far from perfect, but works surprisingly well at least for my needs ;-)

Thanks to @dbtedman for making this possible with his fine PostCSS postcss-prefixwrap plugin.

Prerequisites:

  1. make sure Gulp is installed (yarn global add gulp-cli, the required gulp package is included in package.json)
  2. adapt variables at top of gulpfile.js to your needs
function iterm_tab_and_window_titles_precmd() {
if command git rev-parse --git-dir > /dev/null 2>&1; then
local window_label=$(git rev-parse --show-toplevel)
local tab_label=$(echo $window_label | awk -F\/ '{print "[git] " $NF}')
else
local window_label=${PWD/${HOME}/\~}
local tab_label=$window_label
fi
echo -ne "\e]2;${window_label}\a"
echo -ne "\e]1;${tab_label: -24}\a"