-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f706212
commit a05f42a
Showing
7 changed files
with
607 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"cSpell.words": ["escaperegexp"] | ||
"cSpell.words": ["Attributify", "escaperegexp", "Windi", "withtypes"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# @bassist/uno | ||
|
||
<p> | ||
<a href='https://www.npmjs.com/package/@bassist/uno'> | ||
<img src="https://img.shields.io/npm/v/@bassist/uno?color=f43f5e&label=npm" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@bassist/uno" target="__blank"> | ||
<img src="https://img.shields.io/npm/dm/@bassist/uno?color=f43f5e&label=" /> | ||
</a> | ||
<a href="https://github.com/chengpeiquan/bassist/tree/main/packages/uno" target="__blank"> | ||
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20demos&color=f43f5e" /> | ||
</a> | ||
<a href="https://github.com/chengpeiquan/bassist" target="__blank"> | ||
<img alt="GitHub stars" src="https://img.shields.io/github/stars/chengpeiquan/bassist?style=social" /> | ||
</a> | ||
</p> | ||
|
||
Custom configuration for [UnoCSS](https://unocss.dev/) by [@chengpeiquan](https://github.com/chengpeiquan) . | ||
|
||
## Usage | ||
|
||
With npm(or yarn, or pnpm): | ||
|
||
```bash | ||
npm install -D unocss @bassist/uno | ||
``` | ||
|
||
Yeah, this is a UnoCSS configuration, so you need to install UnoCSS at the same time. | ||
|
||
## Configuration | ||
|
||
Create a configuration file named `uno.config.ts` (or `.js` ) in the root path of the project. | ||
|
||
```ts | ||
// uno.config.ts | ||
import { defineConfig } from '@bassist/uno' | ||
|
||
export default defineConfig() | ||
``` | ||
|
||
See: [Integrations](https://unocss.dev/integrations/) to integrate UnoCSS into your frameworks. | ||
|
||
## Overwrite | ||
|
||
You can overwrite or merge your custom configuration. | ||
|
||
e.g. Specify a theme color as a Hex value. | ||
|
||
```ts | ||
// uno.config.ts | ||
import { defineConfig } from '@bassist/uno' | ||
|
||
export default defineConfig({ | ||
theme: { | ||
colors: { | ||
primary: '#065f46', | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
e.g. Specify a theme color as a CSS Variable. | ||
|
||
```ts | ||
// uno.config.ts | ||
import { defineConfig } from '@bassist/uno' | ||
|
||
export default defineConfig({ | ||
theme: { | ||
colors: { | ||
primary: 'var(--c-primary)', | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
e.g. Specify a theme color as a set of color palettes. | ||
|
||
```ts | ||
// uno.config.ts | ||
import { defineConfig } from '@bassist/uno' | ||
|
||
export default defineConfig({ | ||
theme: { | ||
colors: { | ||
primary: { | ||
100: '#d1fae5', | ||
200: '#a7f3d0', | ||
300: '#6ee7b7', | ||
400: '#34d399', | ||
500: '#10b981', | ||
600: '#059669', | ||
700: '#047857', | ||
800: '#065f46', | ||
900: '#064e3b', | ||
DEFAULT: '#065f46', | ||
}, | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
For more configuration, please refer to the documentation. | ||
|
||
## Documentation | ||
|
||
Based on the preset foundation of [Tailwind CSS](https://tailwindcss.com) and [Windi CSS](https://windicss.org) , some commonly used default configurations are built in, you can refer to their documentation for detailed usage. | ||
|
||
What are the commonly used default configurations? See: [Source Code](https://github.com/chengpeiquan/bassist/tree/main/packages/uno/src/index.ts) . | ||
|
||
## VS Code Extension | ||
|
||
See: [VS Code Extension](https://unocss.dev/integrations/vscode) | ||
|
||
## License | ||
|
||
MIT License © 2023-PRESENT [chengpeiquan](https://github.com/chengpeiquan) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "@bassist/uno", | ||
"version": "0.1.0", | ||
"description": "Custom configuration for UnoCSS by @chengpeiquan .", | ||
"author": "chengpeiquan <[email protected]>", | ||
"license": "MIT", | ||
"homepage": "https://github.com/chengpeiquan/bassist/tree/main/packages/uno", | ||
"files": [ | ||
"lib", | ||
"types" | ||
], | ||
"main": "./lib/index.min.js", | ||
"module": "./lib/index.mjs", | ||
"types": "./types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./lib/index.mjs", | ||
"require": "./lib/index.cjs", | ||
"types": "./types/index.d.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chengpeiquan/bassist.git" | ||
}, | ||
"keywords": [ | ||
"uno", | ||
"unocss", | ||
"unocss config" | ||
], | ||
"devDependencies": { | ||
"unocss": "^0.54.1" | ||
}, | ||
"peerDependencies": { | ||
"unocss": "^0.54.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { | ||
mergeConfigs, | ||
presetAttributify, | ||
presetTypography, | ||
presetUno, | ||
transformerDirectives, | ||
transformerVariantGroup, | ||
} from 'unocss' | ||
|
||
export type Config = ReturnType<typeof mergeConfigs> | ||
|
||
export function defineConfig(configs: Config | Config[] = []): Config { | ||
return mergeConfigs([ | ||
{ | ||
presets: [ | ||
/** | ||
* This preset attempts to provide a common superset | ||
* of the popular utility-first frameworks, | ||
* including Tailwind CSS, Windi CSS, Bootstrap, Tachyons, etc. | ||
* | ||
* @see https://unocss.dev/presets/uno | ||
*/ | ||
presetUno(), | ||
|
||
/** | ||
* This enables the attributify mode for other presets. | ||
* | ||
* @see https://unocss.dev/presets/attributify | ||
*/ | ||
presetAttributify(), | ||
|
||
/** | ||
* Provides a set of prose classes | ||
* you can use to add typographic defaults to vanilla HTML. | ||
* | ||
* @see https://unocss.dev/presets/typography | ||
*/ | ||
presetTypography(), | ||
], | ||
transformers: [ | ||
/** | ||
* You can use a combination of directives and CSS to take advantage of the available utilities. | ||
* | ||
* @see https://unocss.dev/transformers/directives | ||
*/ | ||
transformerDirectives({ | ||
applyVariable: ['--at-apply', '--uno-apply', '--uno'], | ||
}), | ||
|
||
/** | ||
* Apply utilities for the same variant by grouping them with a parenthesis. | ||
* | ||
* @see https://unocss.dev/transformers/variant-group | ||
*/ | ||
transformerVariantGroup(), | ||
], | ||
exclude: ['node_modules'], | ||
}, | ||
...(Array.isArray(configs) ? configs : [configs]), | ||
]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"exclude": ["./lib", "./types"] | ||
} |
Oops, something went wrong.