yummacss 3.3.0 → 3.3.2
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 +1 -25
- package/dist/index.js +1 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A CSS framework for the web with abbreviated styles.
|
|
|
9
9
|
|
|
10
10
|
Yumma CSS is a CLI-first CSS framework packed with a set of non-opinionated, atomic utility classes designed to minimize and scale your codebase.
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### Using the CLI
|
|
13
13
|
|
|
14
14
|
Install `yummacss` as a dev dependency
|
|
15
15
|
|
|
@@ -23,30 +23,6 @@ Initialize configuration
|
|
|
23
23
|
npx yummacss init
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Our [framework guides](https://www.yummacss.com/docs/installation#framework-guides) will teach you how to set up your configuration file.
|
|
27
|
-
|
|
28
|
-
## Development setup
|
|
29
|
-
|
|
30
|
-
The Yumma CSS CLI provides several commands to help you work with your Yumma CSS files.
|
|
31
|
-
|
|
32
|
-
> [!IMPORTANT]
|
|
33
|
-
> Make sure you have a `yumma.config.js` file set up before running these commands. If you haven’t, run `npx yummacss init` first.
|
|
34
|
-
|
|
35
|
-
### Building styles
|
|
36
|
-
|
|
37
|
-
The `build` command will compile your Yumma CSS files once.
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx yummacss build
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Watching changes
|
|
44
|
-
|
|
45
|
-
The `watch` command will watch for changes in your Yumma CSS files and recompile them automatically.
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npx yummacss watch
|
|
49
|
-
```
|
|
50
26
|
|
|
51
27
|
## Documentation
|
|
52
28
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import{Command as e}from"commander";import{existsSync as t,writeFileSync as n}from"fs";import{dirname as r,join as i}from"path";import*as a from"sass-embedded";import{fileURLToPath as o,pathToFileURL as s}from"url";import{z as c}from"zod";import l from"ora";import{transform as u}from"lightningcss";import{globby as d}from"globby";import{PurgeCSS as f}from"purgecss";import p from"
|
|
2
|
-
`,newlineOrSpace:`
|
|
3
|
-
`,pad:i,indent:i+a}:{newline:`@@__STRINGIFY_OBJECT_NEW_LINE__@@`,newlineOrSpace:`@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@`,pad:`@@__STRINGIFY_OBJECT_PAD__@@`,indent:`@@__STRINGIFY_OBJECT_INDENT__@@`},s=e=>{if(n.inlineCharacterLimit===void 0)return e;let t=e.replaceAll(o.newline,``).replaceAll(o.newlineOrSpace,` `).replaceAll(o.pad,``).replaceAll(o.indent,``);return t.length<=n.inlineCharacterLimit?t:e.replaceAll(o.newline,`
|
|
4
|
-
`).replaceAll(o.newlineOrSpace,`
|
|
5
|
-
`).replaceAll(o.pad,i).replaceAll(o.indent,i+a)};if(r.includes(t))return`"[Circular]"`;let c=typeof t;if(t==null||c===`number`||c===`boolean`||c===`function`||D(t))return String(t);if(c===`bigint`)return String(t)+`n`;if(c===`symbol`){let{description:r}=t;if(r===void 0)return`Symbol()`;if(r?.startsWith(`Symbol.`)&&Symbol[r.slice(7)]===t)return r;let i=Symbol.keyFor(t);return i===void 0?`Symbol(${e(r,n)})`:`Symbol.for(${e(i,n)})`}if(t instanceof Date)return Number.isNaN(t.getTime())?`new Date('Invalid Date')`:`new Date('${t.toISOString()}')`;if(t instanceof Map||t instanceof Set){let c=t instanceof Map,l=c?`Map`:`Set`;if(t.size===0)return`new ${l}()`;r.push(t);let u=[...t].map(t=>{if(c){let[r,s]=t;return o.indent+`[${e(r,n,i+a)}, ${e(s,n,i+a)}]`}return o.indent+e(t,n,i+a)}).join(`,`+o.newlineOrSpace);return r.pop(),s(`new ${l}([${o.newline}${u}${o.newline}${o.pad}])`)}if(Array.isArray(t)){if(t.length===0)return`[]`;r.push(t);let c=t.map((r,s)=>{let c=e(r,n,i+a);return n.transform&&(c=n.transform(t,s,c)),o.indent+c}).join(`,`+o.newlineOrSpace);return r.pop(),s(`[${o.newline}${c}${o.newline}${o.pad}]`)}if(O(t)){let c=A(t);if(n.filter&&(c=c.filter(e=>n.filter(t,e))),c.length===0)return`{}`;r.push(t);let l=c.map(r=>{let s=typeof r==`symbol`,c=s?`[${e(r,n)}]`:G(r)?r:e(r,n),l=e(t[r],n,i+a);return n.transform&&(l=n.transform(t,r,l)),o.indent+c+`: `+l}).join(`,`+o.newlineOrSpace);return r.pop(),s(`{${o.newline}${l}${o.newline}${o.pad}}`)}let l=String(t).replaceAll(`\\`,`\\\\`).replaceAll(/[\u0000-\u001F\u007F]/g,e=>K[e]??`\\u${e.codePointAt(0).toString(16).padStart(4,`0`)}`);return n.singleQuotes===!1?`"${l.replaceAll(`"`,String.raw`\"`)}"`:`'${l.replaceAll(`'`,String.raw`\'`)}'`})(e,t,n)}function J(){let e=y.parse({});return{filename:v,content:`export default ${q(e,{indent:` `,singleQuotes:!1})};`}}function Y(){let e=x.progress(`Initializing config...`);try{let{filename:t,content:r}=J();n(t,r),e.succeed(b.init.success)}catch{e.fail(b.init.fail),process.exit(1)}}let X,Z=null,Q=new Set;async function ie(){try{X=await S(),await T(X,!0),x.info(b.watch.start);let e=await d(X.source);m.watch(e,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:200},ignored:/(^|[/\\])\../,ignoreInitial:!0,persistent:!0}).on(`add`,e=>t(e,`added`)).on(`change`,e=>t(e,`changed`)).on(`unlink`,e=>t(e,`removed`));function t(e,t){Q.add(e),Z&&clearTimeout(Z),Z=setTimeout(async()=>{Q.size>0&&(await T(X,!0),Q.clear()),Z=null},500)}}catch{x.error(b.watch.fail),process.exit(1)}}const $=new e;$.name(`yummacss`).description(`Main command`),$.command(`init`).action(Y).alias(`i`).description(`Initialize config`),$.command(`build`).action(()=>T().catch(()=>process.exit(1))).alias(`b`).description(`Build styles once`),$.command(`watch`).action(()=>ie().catch(()=>process.exit(1))).alias(`w`).description(`Build styles continuously`),$.parse(process.argv);export{};
|
|
1
|
+
import{Command as e}from"commander";import{existsSync as t,writeFileSync as n}from"fs";import{dirname as r,join as i}from"path";import*as a from"sass-embedded";import{fileURLToPath as o,pathToFileURL as s}from"url";import{z as c}from"zod";import l from"ora";import{transform as u}from"lightningcss";import{globby as d}from"globby";import{PurgeCSS as f}from"purgecss";import p from"stringify-object";import m from"chokidar";let h={};function g(){return h}function _(e){h=e}function v(e){let t=JSON.stringify(e);return h.configHash!==t}function y(){let e=o(import.meta.url),n=r(e);for(;n!==r(n);){let e=i(n,`package.json`);if(t(e))return n;n=r(n)}return n}const b=y();async function x(e){let t=e.buildOptions.reset?`index.scss`:`core.scss`,n=await a.compileAsync(i(b,`src`,t),{style:`expanded`,loadPaths:[i(b,`src`)],importers:[{findFileUrl(e){return new URL(e,`file://${i(b,`src/`)}`)}}]});return{css:n.css,dependencies:n.loadedUrls.filter(e=>e.protocol===`file:`).map(e=>o(e))}}const S=`yumma.config.mjs`,C=c.object({source:c.array(c.string()).default([``]),output:c.string().default(``),buildOptions:c.object({reset:c.boolean().default(!0),minify:c.boolean().default(!1)}).default({reset:!0,minify:!1})}),w={build:{start:`Building...`,success:(e,t)=>`Build done in ${e}ms. (${t})`,fail:`Build failed.`},init:{fail:`Config failed.`,invalid:`Invalid config.`,notFound:`Config not found.`,success:`Config created.`},watch:{start:`Watching...`,fail:`Watch failed.`},common:{unknownError:`Something went wrong, and we don't know what.`}},T={error:e=>l().fail(e),info:e=>l().info(e),progress:e=>l({spinner:`sand`,color:`white`}).start(e),success:e=>l().succeed(e),warn:e=>l().warn(e)};async function E(){let e=i(process.cwd(),S),n=s(e).href;try{let{default:e}=await import(n);return C.parse(e)}catch(e){throw t(S)?e instanceof c.ZodError&&(T.progress(w.init.invalid).fail(w.init.invalid),process.exit(1)):(T.progress(w.init.notFound).warn(w.init.notFound),process.exit(1)),e}}function D(e,t){return u({filename:`style.css`,code:Buffer.from(e),minify:t.buildOptions.minify,sourceMap:!1}).code.toString()}async function O(e,t){return(await new f().purge({content:await d(t.source),css:[{raw:e}],defaultExtractor:e=>e.match(/[\w-/\\:]+/g)||[]}))[0].css}async function k(e,t=!1){let r=T.progress(w.build.start),i=Date.now();try{let a=e||await E(),o=g(),s=v(a),c;if(t||s||!o.css){let e=await x(a);c=e.css,_({configHash:JSON.stringify(a),css:e.css,dependencies:e.dependencies})}else c=o.css;let l=await O(c,a),u=D(l,a);n(a.output,u),r.succeed(w.build.success(Date.now()-i,a.output))}catch{r.fail(w.build.fail),process.exit(1)}}function A(){let e=C.parse({});return{filename:S,content:`export default ${p(e,{indent:` `,singleQuotes:!1})};`}}function j(){let e=T.progress(`Initializing config...`);try{let{filename:t,content:r}=A();n(t,r),e.succeed(w.init.success)}catch{e.fail(w.init.fail),process.exit(1)}}let M,N=null,P=new Set;async function F(){try{M=await E(),await k(M,!0),T.info(w.watch.start);let e=await d(M.source);m.watch(e,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:200},ignored:/(^|[/\\])\../,ignoreInitial:!0,persistent:!0}).on(`add`,e=>t(e,`added`)).on(`change`,e=>t(e,`changed`)).on(`unlink`,e=>t(e,`removed`));function t(e,t){P.add(e),N&&clearTimeout(N),N=setTimeout(async()=>{P.size>0&&(await k(M,!0),P.clear()),N=null},500)}}catch{T.error(w.watch.fail),process.exit(1)}}const I=new e;I.name(`yummacss`).description(`Main command`),I.command(`init`).action(j).alias(`i`).description(`Initialize config`),I.command(`build`).action(()=>k().catch(()=>process.exit(1))).alias(`b`).description(`Build styles once`),I.command(`watch`).action(()=>F().catch(()=>process.exit(1))).alias(`w`).description(`Build styles continuously`),I.parse(process.argv);export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yummacss",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "A CSS framework for the web with abbreviated styles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css-framework",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"ora": "^8.2.0",
|
|
35
35
|
"purgecss": "^7.0.2",
|
|
36
36
|
"sass-embedded": "^1.90.0",
|
|
37
|
+
"stringify-object": "^6.0.0",
|
|
37
38
|
"zod": "^4.0.17"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
@@ -41,12 +42,12 @@
|
|
|
41
42
|
"@types/stringify-object": "^4.0.5",
|
|
42
43
|
"prettier": "^3.6.2",
|
|
43
44
|
"prettier-plugin-organize-imports": "^4.2.0",
|
|
44
|
-
"stringify-object": "^6.0.0",
|
|
45
45
|
"tsdown": "^0.15.0",
|
|
46
46
|
"typescript": "^5.9.2"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
|
-
"access": "public"
|
|
49
|
+
"access": "public",
|
|
50
|
+
"provenance": true
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
53
|
"build": "tsdown",
|