![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.
Common React components for designing user interfaces
npm install -D cosmo-ui
This project assumes you are using a module bundler that allows you to require scss files such as webpack.
Any css created by the cosmo-ui components will be compiled into your own bundled css, and you will have the opportunity to overwrite it before it is compiled. As such, you must configure your module bundler to allow scss files to be required. It is recommended that you use webpack 2 with css modules as follows:
const extractSASS = new ExtractTextPlugin('/[name].css')
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
loader: extractSASS.extract(['css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader', 'sass-loader'])
}
]
},
plugins: [
extractSASS
]
}
The default variables are located at src/styles/_variables.scss. Any of these variables names can be overridden using the following steps:
alias: {
styles: './path/to/my/styles/folder',
}
Now everytime you try to import something from the "styles" folder, webpack will refer to this location.
Inside your styles folder, add a file called _variables.scss.
Inside the variables file, you can now modify the variables as you wish. When you overwrite a variable be sure to remove the !default tag from the end.
This works because behind the scenes each component will attempt to import 2 variable files:
@import "~styles/variables";
@import "../variables";
The first is your custom variables file. The second is the default fallback.
FAQs
Common React components
The npm package cosmo-ui receives a total of 28 weekly downloads. As such, cosmo-ui popularity was classified as not popular.
We found that cosmo-ui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.