![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
NoCSS is a small, fast, js->css compiler. It lets you write all your css in Javascript. It also has automatic enforcement of browser support levels. Need to support IE 8? NoCSS will make sure you do.
Pure CSS is hard to maintain. This has given rise to a plethora of frameworks, including sass, less, stylus, PostCSS, etc. These frameworks are great, but there was clearly room for simplification, both in language choice and feature set. We chose the most pressing problems with css, and wrote a library to address those, whose core is less than 50 lines of code.
Because of its diminutive size, you can embed it in your frontend code and render css at runtime. Because it's in ES6, it's easy to debug, see how the library works and to augment it to your needs. The goal was to make the simplest, lightest css processor, which could be used at compile-time or run-time.
Here's an example of NoCSS in action:
const nocss = require('nocssjs')();
// Use the auto-prefixer plugin
nocss.use(require('nocssjs/src/plugin/prefix')());
// Use the browser support plugin, ensuring that we
// support ie >= 8 and firefox >= 40
nocss.use(require('nocssjs/src/plugin/support')({
ie: 8,
firefox: 40
}));
// Generate a valid css string (prefix expansions are handled for you)
const styleString = nocss.render({
'body': {
'background-color': 'red',
'ul': {
'padding': '1em',
'display': 'flex'
}
}
});
console.log(styleString);
This example will output the following string:
body {
background-color: red;
}
body ul {
padding: 1em,
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
As you can see, vendor prefixes are handled for you.
It also supports syntactic sugar such as the "&" (concatenate) operator:
nocss.render({
'input,button': {
'&.really-big': {
'transform': 'scale3d(2.0, 2.0, 2.0)'
},
'&:focus': {
'opacity': 0.5
},
'&:before,&:after': {
...
}
}
});
(coming soon)
FAQs
NoCSS -- stop writing CSS, just use Javascript
The npm package nocssjs receives a total of 2 weekly downloads. As such, nocssjs popularity was classified as not popular.
We found that nocssjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.