Socket
Socket
Sign inDemoInstall

rollup-plugin-css-only

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-css-only - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

dist/index.cjs

36

package.json
{
"name": "rollup-plugin-css-only",
"version": "3.1.0",
"version": "4.0.0",
"description": "Rollup plugin that bundles imported css",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"jsnext:main": "dist/index.mjs",
"exports": {
".": {
"import": "./dist/index.mjs",
"default": "./dist/index.cjs"
}
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -cw",
"test:simple": "cd test/simple && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp output.css expected.css && cd ../..",
"test": "npm run test:simple",
"test:nested": "cd test/nested && rm -rf output && rollup -c && cmp output/output.js expected.js && cmp output/output.css expected.css && cd ../..",
"test:simple": "cd test/simple && rm -rf output && rollup -c && cmp output/output.js expected.js && cmp output/output.css expected.css && cd ../..",
"test:win:simple": "cd .\\test\\simple && del -f output.* && rollup -c && cd .. && ECHO n|comp simple\\output.js expected.js && ECHO n|comp simple\\output.css simple\\expected.css && cd ..",
"test": "npm run test:simple && npm run test:nested",
"test:win": "npm run test:win:simple",
"lint": "prettier rollup.config.js src/**",
"prepare": "npm run build",
"prepublish": "npm run build"
"prepublish": "npm run build",
"check-updates": "npx npm-check-updates",
"check-updates:minor": "npx npm-check-updates --target minor",
"check-updates:patch": "npx npm-check-updates --target patch"
},

@@ -35,14 +47,14 @@ "keywords": [

"engines": {
"node": ">=10.12.0"
"node": ">=14"
},
"peerDependencies": {
"rollup": "1 || 2"
"rollup": "<4"
},
"dependencies": {
"@rollup/pluginutils": "4"
"@rollup/pluginutils": "5"
},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",
"rollup": "2"
"@rollup/plugin-buble": "^1.0.0",
"rollup": "<4"
}
}

@@ -18,12 +18,19 @@ # Rollup plugin that bundles imported css

</a>
## Features
- CSS is emitted as 1 asset
- Order of imports is guaranteed
- Watches CSS imports
- Typescript types
## Installation
```
# v4 is compatible with Rollup 3 & 2
npm install --save-dev rollup-plugin-css-only
# If using Node.js lower than 10.12
npm install --save-dev rollup-plugin-css-only@1
```
## Usage
```js

@@ -34,7 +41,9 @@ // rollup.config.js

export default {
entry: 'entry.js',
dest: 'bundle.js',
plugins: [
css({ output: 'bundle.css' })
]
input: 'input.js',
output: {
file: 'output.js',
format: 'es',
assetFileNames: 'assets/[name]-[hash][extname]'
},
plugins: [css()]
}

@@ -47,4 +56,8 @@ ```

import './layout.css'
```
import Vue from 'vue'
```css
/* layout.css */
@import './nested.css';
@import './more.css';
```

@@ -54,24 +67,9 @@

The idea is to keep the options similar to [rollup-plugin-sass](https://github.com/differui/rollup-plugin-sass).
There is 1 option: `output`.
By default the plugin will use `output.assetFileNames` to decide the filename.
There is 1 option: `output`.
By default the plugin will base the filename for the css on the bundle destination.
```js
css({
// Filename to write all styles to
output: 'bundle.css',
// Callback that will be called ongenerate with two arguments:
// - styles: the contents of all style tags combined: 'body { color: green }'
// - styleNodes: an array of style objects: [{lang: 'css', content: 'body { color: green }'}]
output: function (styles, styleNodes) {
writeFileSync('bundle.css', styles)
},
// Disable any style output or callbacks
output: false,
// Default behaviour is to write all styles to the bundle destination where .js is replaced by .css
output: null
// Optional: filename to write all styles to
output: 'bundle.css'
})

@@ -89,6 +87,7 @@ ```

To get it running:
1. Clone the project.
2. `npm install`
3. `npm run build`
1. Clone the project.
2. `npm install`
3. `npm run build`
## Credits

@@ -95,0 +94,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc