@elenajs/plugin-rollup-css 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/README.md +0 -135
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elenajs/plugin-rollup-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Rollup plugin that minifies individual CSS files and optionally concatenates them into a single bundle.",
|
|
5
5
|
"author": "Elena <hi@elenajs.com>",
|
|
6
6
|
"homepage": "https://elenajs.com/",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"vitest": "4.0.18"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "b4c41483e5196b542a1b87361f7d37222737fccc"
|
|
34
34
|
}
|
package/README.md
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://elenajs.com/img/elena-dark.png" alt="Elena" width="201" height="230">
|
|
4
|
-
</source>
|
|
5
|
-
<source media="(prefers-color-scheme: light)" srcset="https://elenajs.com/img/elena.png" alt="Elena" width="201" height="230">
|
|
6
|
-
</source>
|
|
7
|
-
<img src="https://elenajs.com/img/elena.png" alt="Elena" width="201" height="230">
|
|
8
|
-
</picture>
|
|
9
|
-
|
|
10
|
-
### Rollup plugin that minifies and bundles individual Elena CSS files.
|
|
11
|
-
|
|
12
|
-
<br/>
|
|
13
|
-
|
|
14
|
-
<a href="https://arielsalminen.com"><img src="https://img.shields.io/badge/creator-@arielle-F95B1F" alt="Creator @arielle"/></a>
|
|
15
|
-
<a href="https://www.npmjs.com/package/@elenajs/plugin-rollup-css"><img src="https://img.shields.io/npm/v/@elenajs/plugin-rollup-css.svg" alt="Latest version on npm" /></a>
|
|
16
|
-
<a href="https://github.com/getelena/elena/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="Elena is released under the MIT license." /></a>
|
|
17
|
-
<a href="https://github.com/getelena/elena/actions/workflows/tests.yml"><img src="https://github.com/getelena/elena/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<br/>
|
|
22
|
-
|
|
23
|
-
<p align="center"><strong>@elenajs/plugin-rollup-css</strong> is a <a href="https://rollupjs.org">Rollup</a> plugin that minifies individual Elena CSS files and optionally concatenates them into a single bundle. Built for <a href="https://elenajs.com">Elena</a> Progressive Web Component libraries, but works with any Rollup project.</p>
|
|
24
|
-
|
|
25
|
-
<br/>
|
|
26
|
-
|
|
27
|
-
## Table of contents
|
|
28
|
-
|
|
29
|
-
- **[Install](#install)**
|
|
30
|
-
- **[Usage](#usage)**
|
|
31
|
-
- **[Individual CSS files](#individual-css-files)**
|
|
32
|
-
- **[CSS bundle](#css-bundle)**
|
|
33
|
-
- **[Both together](#both-together)**
|
|
34
|
-
- **[API](#api)**
|
|
35
|
-
- **[`cssPlugin(srcDir)`](#csspluginsrcdir)**
|
|
36
|
-
- **[`cssBundlePlugin(srcDir, fileName)`](#cssbundlepluginsrcdir-filename)**
|
|
37
|
-
- **[`minifyCss(css, filename?)`](#minifycsscss-filename)**
|
|
38
|
-
|
|
39
|
-
## Install
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm install --save-dev @elenajs/plugin-rollup-css
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Peer dependency:** `rollup >= 4.0.0`
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
### Individual CSS files
|
|
50
|
-
|
|
51
|
-
Emit minified copies of each CSS file from your source directory:
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
// rollup.config.js
|
|
55
|
-
import { cssPlugin } from "@elenajs/plugin-rollup-css";
|
|
56
|
-
|
|
57
|
-
export default {
|
|
58
|
-
input: "src/index.js",
|
|
59
|
-
output: { dir: "dist", format: "esm" },
|
|
60
|
-
plugins: [cssPlugin("src")],
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This scans `src/` for `.css` files and emits each one (minified) into the output directory, preserving the original file name.
|
|
65
|
-
|
|
66
|
-
### CSS bundle
|
|
67
|
-
|
|
68
|
-
Concatenate all CSS files into a single minified bundle:
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
// rollup.config.js
|
|
72
|
-
import { cssBundlePlugin } from "@elenajs/plugin-rollup-css";
|
|
73
|
-
|
|
74
|
-
export default {
|
|
75
|
-
input: "src/index.js",
|
|
76
|
-
output: { dir: "dist", format: "esm" },
|
|
77
|
-
plugins: [cssBundlePlugin("src", "bundle.css")],
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Both together
|
|
82
|
-
|
|
83
|
-
Use both plugins to emit individual files and a concatenated bundle:
|
|
84
|
-
|
|
85
|
-
```js
|
|
86
|
-
// rollup.config.js
|
|
87
|
-
import { cssPlugin, cssBundlePlugin } from "@elenajs/plugin-rollup-css";
|
|
88
|
-
|
|
89
|
-
export default {
|
|
90
|
-
input: "src/index.js",
|
|
91
|
-
output: { dir: "dist", format: "esm" },
|
|
92
|
-
plugins: [
|
|
93
|
-
cssPlugin("src"),
|
|
94
|
-
cssBundlePlugin("src", "bundle.css"),
|
|
95
|
-
],
|
|
96
|
-
};
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## API
|
|
100
|
-
|
|
101
|
-
### `cssPlugin(srcDir)`
|
|
102
|
-
|
|
103
|
-
Returns a Rollup plugin that finds all `.css` files in `srcDir` and emits each one as a minified asset.
|
|
104
|
-
|
|
105
|
-
| Parameter | Type | Description |
|
|
106
|
-
| --------- | -------- | ------------------------------------------ |
|
|
107
|
-
| `srcDir` | `string` | Source directory to scan for `.css` files. |
|
|
108
|
-
|
|
109
|
-
### `cssBundlePlugin(srcDir, fileName)`
|
|
110
|
-
|
|
111
|
-
Returns a Rollup plugin that concatenates all `.css` files in `srcDir`, minifies the result, and emits it as a single asset.
|
|
112
|
-
|
|
113
|
-
| Parameter | Type | Description |
|
|
114
|
-
| ---------- | -------- | ----------------------------------------------------- |
|
|
115
|
-
| `srcDir` | `string` | Source directory to scan for `.css` files. |
|
|
116
|
-
| `fileName` | `string` | Output filename for the bundle (e.g. `"bundle.css"`). |
|
|
117
|
-
|
|
118
|
-
### `minifyCss(css, filename?)`
|
|
119
|
-
|
|
120
|
-
Minifies a CSS string using [Lightning CSS](https://lightningcss.dev/).
|
|
121
|
-
|
|
122
|
-
| Parameter | Type | Description |
|
|
123
|
-
| ----------- | -------- | -------------------------------------- |
|
|
124
|
-
| `css` | `string` | The CSS source to minify. |
|
|
125
|
-
| `filename?` | `string` | Optional filename for error reporting. |
|
|
126
|
-
|
|
127
|
-
**Returns:** `string`, the minified CSS.
|
|
128
|
-
|
|
129
|
-
## License
|
|
130
|
-
|
|
131
|
-
MIT
|
|
132
|
-
|
|
133
|
-
## Copyright
|
|
134
|
-
|
|
135
|
-
Copyright © 2026 [Ariel Salminen](https://arielsalminen.com)
|