A CSS library of predefined variable names similar to TailwindCSS naming and similar to OpenProps system with minor deviations from the naming scheme.
I was using Tailwind in some of my projects, and Open Props in my project before. I liked Tailwind and the naming and units were perfect but I felt like the HTML was too messy. I liked Open Props too but I preferred the naming and units of Tailwind. With this, it is the same concept as Open Props but with Tailwind's naming and units
It forces you to write more consistent code using variables instead of using magic numbers.
Using Tailwind's @apply feature is quite similar but you have to do more config. @apply isn't reccomended either and might be deprecated in the future. Using Open Props is similar too but it doesn't have the naming and units of Tailwind
Anyone who is writing CSS. Inline styles, Sass, Tailwind arbitrary values, etc.
-
Install the npm package
npm i twprops
-
Import the CSS file you need inside
node_modules/twprops/
@import "/node_modules/twprops/"
- Install PostCSS JIT Props
npm install postcss-jit-props
- Add the following lines of code inside your
postcss.config.js
// postcss.config.js
- Add this line in your CSS
@import "https://unpkg.com/twprops/twprops.min.css"
-
Install this extension.
-
Go inside the extensions tab (Ctrl + Shift + X).
-
Find the extension.
-
Click on the settings icon (cog) and a modal will appear.
-
Click "Extension Settings".
-
Go to "CSS Variables: Blacklist Folders" and open it inside
settings.json
. -
Delete the line that contains
node_modules
inside the array."cssVariables.blacklistFolders": [ // Some stuff here "**/node_modules", // Some stuff here also ],
All of the variables take up atleast 600+ lines of code and is 14kb minified without Gzip nor Brotli compression. You can use PurgeCSS to remove all of the unused variables since TailwindProps doesn't have a just-in-time feature at the moment. Just use their docs instead of a guide here.
<div class="w-full bg-red-400 h-full font-bold"> </div>
<div> </div>
div {
width: var(--spacing-full);
height: var(--spacing-full);
background-color: var(--red-400);
font-weight: var(--font-bold);
}
- Less config
- Framework agnostic
- Best of both worlds! (Tailwind & OpenProps)
- Complete all variables
- Make a website
- Make NPM package
- Write better docs
- Get first contributor
- Test for performanced compared to Tailwind, OpenProps, and TailwindProps
- Make more stuff consistent