@hiscovega/grisso 1.0.3 → 1.0.4
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/README.md +85 -17
- package/package.json +6 -4
- package/plugin.js +1 -1
- package/tokens-example.css +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## Instalación
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @hiscovega/grisso
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Uso
|
|
@@ -16,13 +16,13 @@ Importa el CSS pre-compilado directamente. Útil para desarrollo o cuando no usa
|
|
|
16
16
|
|
|
17
17
|
```css
|
|
18
18
|
/* En tu CSS global */
|
|
19
|
-
@import "@
|
|
19
|
+
@import "@hiscovega/grisso";
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
O en HTML:
|
|
23
23
|
|
|
24
24
|
```html
|
|
25
|
-
<link rel="stylesheet" href="node_modules/@
|
|
25
|
+
<link rel="stylesheet" href="node_modules/@hiscovega/grisso/dist/grisso.css" />
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Opción B: PostCSS plugin (recomendado — con tree-shaking)
|
|
@@ -31,7 +31,7 @@ Añade el plugin a tu configuración de PostCSS. El CSS de Grisso se inyecta aut
|
|
|
31
31
|
|
|
32
32
|
```js
|
|
33
33
|
// postcss.config.js
|
|
34
|
-
import grisso from "@
|
|
34
|
+
import grisso from "@hiscovega/grisso/plugin";
|
|
35
35
|
|
|
36
36
|
export default {
|
|
37
37
|
plugins: [
|
|
@@ -53,19 +53,10 @@ grisso();
|
|
|
53
53
|
Usa `buildCSS()` directamente desde Node.js. Genera, purga y optimiza CSS sin depender de PostCSS — ideal para scripts de build, herramientas custom o entornos donde PostCSS no está disponible.
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
|
-
import { buildCSS } from "@
|
|
56
|
+
import { buildCSS } from "@hiscovega/grisso/build";
|
|
57
57
|
|
|
58
58
|
// Build completo (todo el CSS, minificado)
|
|
59
59
|
const css = await buildCSS();
|
|
60
|
-
|
|
61
|
-
// Build con tree-shaking
|
|
62
|
-
const css = await buildCSS({
|
|
63
|
-
content: ["./src/**/*.{js,ts,jsx,tsx,css}"],
|
|
64
|
-
config: "./grisso.config.mjs",
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Build sin minificar
|
|
68
|
-
const css = await buildCSS({ minify: false });
|
|
69
60
|
```
|
|
70
61
|
|
|
71
62
|
**Opciones de `buildCSS()`:**
|
|
@@ -78,6 +69,83 @@ const css = await buildCSS({ minify: false });
|
|
|
78
69
|
|
|
79
70
|
Sin `content`, se incluye todo el CSS. Con `content`, se eliminan las clases no usadas via PurgeCSS.
|
|
80
71
|
|
|
72
|
+
#### Ejemplos
|
|
73
|
+
|
|
74
|
+
**Tree-shaking** — solo las clases que usa tu proyecto:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const css = await buildCSS({
|
|
78
|
+
content: ["./src/**/*.{js,ts,jsx,tsx}", "./src/**/*.css"],
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Config personalizada + tree-shaking:**
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
const css = await buildCSS({
|
|
86
|
+
config: "./grisso.config.mjs",
|
|
87
|
+
content: ["./src/**/*.{js,ts,jsx,tsx,css}"],
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**CSS sin minificar** (útil para depuración):
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
const css = await buildCSS({ minify: false });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Script de build** — genera un archivo CSS para producción:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
// scripts/build-css.mjs
|
|
101
|
+
import { writeFileSync } from "node:fs";
|
|
102
|
+
import { buildCSS } from "@hiscovega/grisso/build";
|
|
103
|
+
|
|
104
|
+
const css = await buildCSS({
|
|
105
|
+
content: ["./src/**/*.{jsx,tsx,css}"],
|
|
106
|
+
config: "./grisso.config.mjs",
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
writeFileSync("./dist/styles.css", css);
|
|
110
|
+
console.log(`CSS generado: ${css.length} bytes`);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Integración con Vite** (plugin custom):
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
// vite.config.js
|
|
117
|
+
import { buildCSS } from "@hiscovega/grisso/build";
|
|
118
|
+
|
|
119
|
+
export default {
|
|
120
|
+
plugins: [
|
|
121
|
+
{
|
|
122
|
+
name: "grisso",
|
|
123
|
+
async buildStart() {
|
|
124
|
+
const css = await buildCSS({
|
|
125
|
+
content: ["./src/**/*.{jsx,tsx,css}"],
|
|
126
|
+
});
|
|
127
|
+
this.emitFile({ type: "asset", fileName: "grisso.css", source: css });
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Servidor de desarrollo** — generar CSS on-the-fly:
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
// Ejemplo con Express
|
|
138
|
+
import express from "express";
|
|
139
|
+
import { buildCSS } from "@hiscovega/grisso/build";
|
|
140
|
+
|
|
141
|
+
const app = express();
|
|
142
|
+
|
|
143
|
+
app.get("/grisso.css", async (req, res) => {
|
|
144
|
+
const css = await buildCSS({ minify: false });
|
|
145
|
+
res.type("text/css").send(css);
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
81
149
|
## Configuración personalizada
|
|
82
150
|
|
|
83
151
|
Crea un `grisso.config.mjs` en la raíz de tu proyecto para extender o reemplazar los tokens por defecto. Sigue el patrón de Tailwind v3:
|
|
@@ -115,14 +183,14 @@ grisso({
|
|
|
115
183
|
|
|
116
184
|
Si no se pasa `config`, el plugin busca automáticamente `grisso.config.mjs` en el directorio de trabajo. Si no existe, usa los defaults.
|
|
117
185
|
|
|
118
|
-
Los defaults se pueden consultar importando `@
|
|
186
|
+
Los defaults se pueden consultar importando `@hiscovega/grisso/config`.
|
|
119
187
|
|
|
120
188
|
## Design Tokens (CSS custom properties)
|
|
121
189
|
|
|
122
190
|
Grisso usa CSS custom properties para todos los valores. Copia `tokens-example.css` y adapta los valores a tu design system:
|
|
123
191
|
|
|
124
192
|
```bash
|
|
125
|
-
cp node_modules/@
|
|
193
|
+
cp node_modules/@hiscovega/grisso/tokens-example.css src/tokens.css
|
|
126
194
|
```
|
|
127
195
|
|
|
128
196
|
```css
|
|
@@ -140,7 +208,7 @@ Importa los tokens antes que Grisso en tu CSS global:
|
|
|
140
208
|
|
|
141
209
|
```css
|
|
142
210
|
@import "./tokens.css";
|
|
143
|
-
@import "@
|
|
211
|
+
@import "@hiscovega/grisso"; /* o via plugin de PostCSS */
|
|
144
212
|
```
|
|
145
213
|
|
|
146
214
|
## Clases disponibles
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hiscovega/grisso",
|
|
3
3
|
"description": "Griddo CSS utility class library",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
@@ -39,12 +39,14 @@
|
|
|
39
39
|
"prepublishOnly": "npm run build",
|
|
40
40
|
"release": "release-it"
|
|
41
41
|
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"browserslist": "^4.24.0",
|
|
44
|
+
"lightningcss": "^1.28.0",
|
|
45
|
+
"purgecss": "^6.0.0"
|
|
46
|
+
},
|
|
42
47
|
"devDependencies": {
|
|
43
48
|
"@biomejs/biome": "2.4.5",
|
|
44
49
|
"@types/node": "^25.3.3",
|
|
45
|
-
"browserslist": "^4.24.0",
|
|
46
|
-
"lightningcss": "^1.28.0",
|
|
47
|
-
"purgecss": "^6.0.0",
|
|
48
50
|
"release-it": "^19.2.4",
|
|
49
51
|
"typescript": "^5.9.3",
|
|
50
52
|
"vitest": "^4.0.18"
|
package/plugin.js
CHANGED
|
@@ -15,7 +15,7 @@ import { purgeCSS } from "./lib/purge.js";
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* // postcss.config.js del proyecto consumidor
|
|
18
|
-
* import grisso from "@
|
|
18
|
+
* import grisso from "@hiscovega/grisso/plugin";
|
|
19
19
|
* export default {
|
|
20
20
|
* plugins: [
|
|
21
21
|
* grisso({ content: ["./src/**\/*.{js,ts,jsx,tsx,css}"] })
|
package/tokens-example.css
CHANGED