Skip to content

Commit

Permalink
fix(plugins): remove defaults from unocss plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelrk committed Aug 8, 2023
1 parent 86c8227 commit b397d6f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/latest/examples/using-twind-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
};
```

(Note: the `as Preset` cast is required to fix a typing issue with twind.)
Note: the `as Preset` cast is required to fix a typing issue with twind.

To see what other presets exist, you can go to the
[twind docs](https://twind.style/presets).
2 changes: 2 additions & 0 deletions docs/latest/examples/using-unocss.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ export default {
} satisfies UserConfig;
```

Note: you could also inline the config object in `main.ts` instead of using a separate `uno.config.ts` file.

To see what other presets exist, you can go to the
[unocss docs](https://unocss.dev/presets/).
7 changes: 1 addition & 6 deletions plugins/unocss.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import type { UserConfig } from "https://esm.sh/@unocss/[email protected]";
import { UnoGenerator } from "https://esm.sh/@unocss/[email protected]";
import presetUno from "https://esm.sh/@unocss/[email protected]";
import { Plugin } from "$fresh/server.ts";

// inline reset from https://esm.sh/@unocss/[email protected]/tailwind.css
const unoResetCSS = `/* reset */
*,:before,:after{box-sizing:border-box;border:0 solid}html{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}
`;

const defaultConfig: UserConfig = {
presets: [presetUno()],
};

export default function unocss(config: UserConfig = defaultConfig): Plugin {
export default function unocss(config: UserConfig): Plugin {
const uno = new UnoGenerator(config);
return {
name: "unocss",
Expand Down

0 comments on commit b397d6f

Please sign in to comment.