Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
next-css-json-loader
Advanced tools
transforms .css files into js modules that export style rules as json
$ npm install --save-dev next-css-json-loader
First you will need to create a next.config.js
file:
module.exports = {
webpack: config => {
config.module.rules.push({
test: /\.css$/,
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]',
}
}, {
test: /\.css$/,
loader: 'babel-loader!next-css-json-loader',
});
return config;
},
};
After setting the project, you may import CSS files like so:
// .css files now conveniently expose all styles as js objects
import styles, {
rule,
media,
keyframes,
fontFace,
charset,
raw
} from 'some-package/foo.css';
// If you are using glamor, you can easily generate styles like so
import { css } from 'glamor';
const className = css(styles);
// Don't forget any custom fonts or animations :)
const fonts = fontFace.map(x => css.fontFace(x));
const animations = keyframes.reduce((a, [name, timeline]) => {
a[name] = css.keyframe(timeline);
return a;
}, {});
Shout out to next-style-loader for inspiration!
FAQs
transforms .css files into js modules that export style rules as json
The npm package next-css-json-loader receives a total of 7 weekly downloads. As such, next-css-json-loader popularity was classified as not popular.
We found that next-css-json-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.