@hiscovega/grisso 1.0.4 → 1.0.5

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 CHANGED
@@ -12,7 +12,7 @@ npm install @hiscovega/grisso
12
12
 
13
13
  ### Opción A: CSS directo
14
14
 
15
- Importa el CSS pre-compilado directamente. Útil para desarrollo o cuando no usas PostCSS.
15
+ Importa el CSS pre-compilado directamente. Útil para desarrollo.
16
16
 
17
17
  ```css
18
18
  /* En tu CSS global */
@@ -25,32 +25,45 @@ O en HTML:
25
25
  <link rel="stylesheet" href="node_modules/@hiscovega/grisso/dist/grisso.css" />
26
26
  ```
27
27
 
28
- ### Opción B: PostCSS plugin (recomendado — con tree-shaking)
28
+ ### Opción B: CLI
29
29
 
30
- Añade el plugin a tu configuración de PostCSS. El CSS de Grisso se inyecta automáticamente y solo las clases usadas llegan al bundle final.
30
+ Genera CSS desde la terminal. Ideal para scripts de build y CI/CD.
31
31
 
32
- ```js
33
- // postcss.config.js
34
- import grisso from "@hiscovega/grisso/plugin";
32
+ ```bash
33
+ # CSS completo a stdout
34
+ npx grisso build
35
35
 
36
- export default {
37
- plugins: [
38
- grisso({
39
- content: ["./src/**/*.{js,ts,jsx,tsx,css}"],
40
- }),
41
- ],
42
- };
43
- ```
36
+ # Escribir a archivo
37
+ npx grisso build --output dist/grisso.css
44
38
 
45
- Sin `content`, se incluye todo el CSS (útil en desarrollo):
39
+ # Con config personalizada
40
+ npx grisso build --config grisso.config.mjs --output dist/grisso.css
46
41
 
47
- ```js
48
- grisso();
42
+ # Tree-shaking (solo clases usadas)
43
+ npx grisso build --content "src/**/*.tsx" --content "src/**/*.css" --output dist/grisso.css
44
+
45
+ # Sin minificar (útil para depuración)
46
+ npx grisso build --no-minify --output dist/grisso.css
47
+
48
+ # Pipear a otro comando
49
+ npx grisso build | pbcopy
49
50
  ```
50
51
 
51
- ### Opción C: API programática (sin PostCSS)
52
+ **Flags de `grisso build`:**
53
+
54
+ | Flag | Descripción |
55
+ |---|---|
56
+ | `--config <ruta>` | Ruta a `grisso.config.mjs` |
57
+ | `--content <glob>` | Globs para tree-shaking (repetible) |
58
+ | `--output <ruta>` | Archivo de salida (sin `--output` → stdout) |
59
+ | `--no-minify` | Deshabilitar minificación |
60
+ | `--help, -h` | Ayuda del comando |
61
+
62
+ Sin `--output`, el CSS va a stdout y los mensajes de estado a stderr, siguiendo la convención Unix.
52
63
 
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.
64
+ ### Opción C: API programática
65
+
66
+ Usa `buildCSS()` directamente desde Node.js. Genera, purga y optimiza CSS — ideal para scripts de build, herramientas custom o integración con cualquier bundler.
54
67
 
55
68
  ```js
56
69
  import { buildCSS } from "@hiscovega/grisso/build";
@@ -172,16 +185,7 @@ export default {
172
185
  };
173
186
  ```
174
187
 
175
- Pasa la ruta al plugin:
176
-
177
- ```js
178
- grisso({
179
- content: ["./src/**/*.{js,ts,jsx,tsx,css}"],
180
- config: "./grisso.config.mjs",
181
- });
182
- ```
183
-
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.
188
+ Si no se pasa `config` a `buildCSS()`, busca automáticamente `grisso.config.mjs` en el directorio de trabajo. Si no existe, usa los defaults.
185
189
 
186
190
  Los defaults se pueden consultar importando `@hiscovega/grisso/config`.
187
191
 
@@ -208,7 +212,7 @@ Importa los tokens antes que Grisso en tu CSS global:
208
212
 
209
213
  ```css
210
214
  @import "./tokens.css";
211
- @import "@hiscovega/grisso"; /* o via plugin de PostCSS */
215
+ @import "@hiscovega/grisso";
212
216
  ```
213
217
 
214
218
  ## Clases disponibles
@@ -219,7 +223,7 @@ Importa los tokens antes que Grisso en tu CSS global:
219
223
  {breakpoint}-{propiedad}-{escala}
220
224
  ```
221
225
 
222
- Ejemplos: `flex`, `tablet-flex`, `p-md`, `desktop-mt-lg`, `text-center`
226
+ Ejemplos: `flex`, `tablet-flex`, `p-md`, `desktop-mt-lg`, `text-center`, `w-1/2`, `z-10`, `tracking-tight`
223
227
 
224
228
  ### Breakpoints (mobile-first)
225
229
 
@@ -232,22 +236,22 @@ Ejemplos: `flex`, `tablet-flex`, `p-md`, `desktop-mt-lg`, `text-center`
232
236
 
233
237
  ### Categorías
234
238
 
235
- | Categoría | Ejemplos |
236
- | -------------- | -------------------------------------------------------------------- |
237
- | **Layout** | `flex`, `block`, `hidden`, `relative`, `absolute`, `overflow-hidden` |
238
- | **Flex/Grid** | `flex-col`, `flex-wrap`, `items-center`, `justify-between`, `gap-md` |
239
- | **Spacing** | `p-sm`, `pt-lg`, `mx-auto`, `mt-xs`, `mb-md` |
240
- | **Sizing** | `w-full`, `h-full`, `w-1`, `max-w-full` |
241
- | **Tipografía** | `text-1`, `text-center`, `font-bold`, `leading-tight` |
242
- | **Fondos** | `bg-1`, `bg-ui`, `bg-cover`, `bg-center` |
243
- | **Bordes** | `border-sm`, `divide-x`, `outline-none` |
244
- | **Efectos** | `shadow-md`, `opacity-3`, `overlay-2` |
245
- | **Iconos** | `icon-1`, `icon-3` |
239
+ | Categoría | Ejemplos |
240
+ | -------------- | ----------------------------------------------------------------------------- |
241
+ | **Layout** | `flex`, `block`, `hidden`, `relative`, `absolute`, `overflow-hidden`, `inset-0`, `inset-x-sm`, `z-10` |
242
+ | **Flex/Grid** | `flex-col`, `flex-wrap`, `items-center`, `justify-between`, `gap-md` |
243
+ | **Spacing** | `p-sm`, `pt-lg`, `mx-auto`, `mt-xs`, `mb-md` |
244
+ | **Sizing** | `w-full`, `h-full`, `w-1/2`, `w-2/3`, `h-1/4`, `max-w-full` |
245
+ | **Tipografía** | `text-1`, `text-center`, `font-bold`, `font-light`, `leading-snug`, `tracking-tight` |
246
+ | **Fondos** | `bg-1`, `bg-ui`, `bg-cover`, `bg-center` |
247
+ | **Bordes** | `border-sm`, `border-1`, `border-t-sm`, `divide-x`, `outline-none` |
248
+ | **Efectos** | `shadow-md`, `opacity-3`, `overlay-2` |
249
+ | **Iconos** | `icon-1`, `icon-3` |
246
250
 
247
251
  ## Build
248
252
 
249
253
  ```bash
250
- npm run build # Compila TS + genera dist/grisso.css (~156 KB)
254
+ npm run build # Compila TS + genera dist/grisso.css (~154 KB)
251
255
  npm run typecheck # Type-check sin emitir (tsc --noEmit)
252
256
  npm run lint # Lint con Biome
253
257
  npm test # Tests con Vitest
@@ -255,27 +259,20 @@ npm run test:watch # Tests en modo watch
255
259
  npm run playground # Build + tree-shake + abre playground/index.html
256
260
  ```
257
261
 
258
- ### Build script
262
+ ### CLI
259
263
 
260
- El script de build acepta flags opcionales:
261
-
262
- ```bash
263
- node scripts/build.js # Full build → dist/grisso.css
264
- node scripts/build.js --config grisso.config.mjs # Con config personalizada
265
- node scripts/build.js --content "src/**/*.html" --output out.css # Tree-shaken
266
- node scripts/build.js --config conf.mjs --content "src/**" --output x # Todo junto
267
- ```
264
+ El CLI se usa internamente y está disponible para consumidores via `npx grisso build`. Ver [Opción B: CLI](#opción-b-cli) para detalles completos.
268
265
 
269
- Con `--content`, se usa PurgeCSS para eliminar clases no usadas (156 KB → ~4 KB en el playground).
266
+ Con `--content`, se usa PurgeCSS para eliminar clases no usadas (~154 KB → ~4 KB en el playground).
270
267
 
271
268
  ## Desarrollo: Añadir nuevas utilities
272
269
 
273
- 1. Edita el partial correspondiente en `src/js/partials/{category}.ts`
270
+ 1. Edita el partial correspondiente en `src/partials/{category}.ts`
274
271
  2. Usa `simpleClass`, `complexClass` o `customClass` con los tokens del config
275
272
  3. Ejecuta `npm run build`
276
273
 
277
274
  ```ts
278
- // src/js/partials/layout.ts
275
+ // src/partials/layout.ts
279
276
  import { simpleClass, complexClass } from "../generators.js";
280
277
 
281
278
  // Clase simple — genera .flex + variantes responsive