
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@modular-css/rollup
Advanced tools
Rollup support for modular-css.
> npm i @modular-css/rollup
Due to API changes, certain major versions of this plugin will require a specific minimum rollup version. This is expressed within the peerDependency field in package.json and replicated here for ease of reference.
@modular-css/rollup@19 requires rollup@1.0.0@modular-css/rollup@18 requires rollup@0.68.0@modular-css/rollup@15 requires rollup@0.65.0@modular-css/rollup@11 requires rollup@0.60.0const bundle = await rollup({
input : "./index.js",
plugins : [
require("@modular-css/rollup")()
]
});
import css from "@modular-css/rollup";
export default {
input : "./index.js",
output : {
dest : "./gen/bundle.js",
format : "umd"
},
plugins : [
css()
]
};
Write your modular-css styles in a .css file
/* style.css */
@value error: red;
.rule {
border: 1px solid error;
}
import it from your JS, either as named exports
// Named exports
import { rule, $values } from "./style.css";
console.log(rule); // .mc_abcdefrule
console.log($values); // { error : "red" }
or using the default export
// Default export
import css from "./style.css";
console.log(css.rule); // .mc_abcdefrule
console.log(css.$values); // { error : "red" }
commonFile name to use in case there are any CSS dependencies that appear in multiple bundles. Defaults to "common.css".
devEnable dev mode. In dev mode the default export of a CSS file will be a Proxy instead of a bare object. Attempts to access non-existant properties on the proxy will throw a ReferenceError to assist in catching missing class references.
include/excludeA minimatch pattern, or an array of minimatch patterns, relative to process.cwd(). include defaults to **/*.css.
jsonBoolean/String to determine if JSON files containing all exported classes & values should be output. If set to true will write out to a file named exports.json. If a String will write out to that file name. Defaults to false.
mapBoolean to determine if inline source maps should be included. Defaults to true.
To force the creation of external source maps set the value to { inline : false }.
metaBoolean/String to determine if chunk metadata should be output. If set to true will write out a file named metadata.json. If a String will write out to that file name. Defaults to false.
Currently the only metadata being written is CSS dependencies, but that may change in the future.
namedExports.rewriteInvalidThe rollup plugin will rewrite invalid identifiers using identifierfy by default. You can disable this behavior by setting namedExports to { rewriteInvalid : false }.
styleExportBy default this plugin will extract and bundle CSS in a separate file. If you would like the styles from each imported CSS file to be exported as a string for use in JS, you can enable this by setting styleExport to true. If you are using this option the after & done hooks will not run against the exported styles, you should perform any additional CSS transformations in the processing hook instead.
import { styles } from "./styles.css";
Enable styleExport will also disable the plugin from emitting any assets as well as sourcemaps (unless you explicitly opt-in to sourcemaps via the map option)
defaultExportYou can disable exporting classes as default export, eg import styles from "./style.css";, by setting defaultExport to false. Defaults to true.
variableDeclarationYou can set variable declaration kind, eg var mc_rule = ...;, by setting variableDeclaration to var. Defaults to const.
emptiesSet to true to enable writing out CSS files that don't contain any content (like if you have a CSS file that contains only @value rules).
processorPass an already-instantiated Processor instance to the rollup plugin. It will then add any files found when traversing the modules to it and both the rollup-discovered and any already-existing files will be output in the final CSS.
verboseEnable verbose logging while running to help diagnose issues
All other options are passed to the underlying Processor instance, see Options.
FAQs
Add modular-css support to rollup
The npm package @modular-css/rollup receives a total of 58 weekly downloads. As such, @modular-css/rollup popularity was classified as not popular.
We found that @modular-css/rollup demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.