Skip to content

Commit 9863cd8

Browse files
committed
init
0 parents  commit 9863cd8

18 files changed

Lines changed: 2972 additions & 0 deletions

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "vnphanquang/phosphor-icons-tailwindcss" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.changeset/unlucky-zebras-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'phosphor-icons-tailwindcss': major
3+
---
4+
5+
here be dragons

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Editor configuration, see https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = tab
10+
indent_size = 2
11+
trim_trailing_whitespace = true
12+
max_line_length = 100
13+
14+
[*.md]
15+
indent_size = 4
16+
17+
[*.yaml]
18+
indent_size = 2
19+
indent_style = space
20+

.github/FUNDING.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: vnphanquang

.github/workflows/changesets.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Changesets
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- '.changeset/**'
8+
- '.github/workflows/changesets.yaml'
9+
workflow_dispatch:
10+
11+
env:
12+
CI: true
13+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
14+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
15+
HUSKY: 0
16+
jobs:
17+
Version:
18+
if: github.repository == 'vnphanquang/phosphor-icons-tailwindcss' # prevents this action from running on forks
19+
permissions:
20+
contents: write # to create release (changesets/action)
21+
id-token: write # OpenID Connect token needed for provenance
22+
pull-requests: write # to create pull request (changesets/action)
23+
timeout-minutes: 5
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@v4
32+
- name: Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: pnpm
37+
- name: Install dependencies
38+
run: pnpm install --ignore-scripts --no-frozen-lockfile
39+
- name: Create release PR or Publish to npm
40+
uses: changesets/action@v1
41+
with:
42+
version: pnpm ci:version
43+
publish: pnpm ci:publish
44+
commit: 'chore(release): changesets versioning & publication'
45+
title: 'Changesets: Versioning & Publication'
46+
createGithubReleases: true
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
6+
# misc
7+
.DS_Store
8+
*.pem
9+
10+
# debug
11+
*.log*
12+

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CHANGELOG.md
2+
node_modules/
3+
pnpm-lock.yaml
4+

CHANGELOG.md

Whitespace-only changes.

README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<img src="/meta/phosphor-mark-tight-yellow.png" width="128" align="right" />
2+
3+
# phosphor-icons-tailwindcss
4+
5+
A [TailwindCSS] plugin for the [Phosphor icon set][phosphor].
6+
7+
[![MIT][license.badge]][license] [![npm.badge]][npm]
8+
9+
## Installation
10+
11+
1. install package:
12+
13+
```bash
14+
pnpm add -D phosphor-icons-tailwindcss # or via npm, yarn, ...
15+
```
16+
17+
2. register the plugin in your `tailwind.config.js`:
18+
19+
```js
20+
// tailwind.config.js
21+
import phosphorIcons from "phosphor-icons-tailwindcss";
22+
23+
/** @type {import("tailwindcss").Config } */
24+
export default {
25+
plugins: [phosphorIcons()],
26+
};
27+
```
28+
29+
Or if you are using Tailwind 4:
30+
31+
```css
32+
/* app.css, or whatever your entry CSS is */
33+
@import 'tailwindcss';
34+
@plugin 'phosphor-icons-tailwindcss';
35+
```
36+
37+
## Usage
38+
39+
You need to add two classes to your markup:
40+
41+
1. the base `ph` class,
42+
2. a class with the syntax: `ph-[<name><--weight>]`, corresponding to your desired icon.
43+
44+
> [!NOTE]
45+
> `weight` is optional and defaults to "regular" if not specified.
46+
47+
For example:
48+
49+
```html
50+
<p>
51+
<i class="ph ph-[info]"></i> <!-- render the regular info icon -->
52+
<i class="ph ph-[pulse--duotone]"></i> <!-- render the pulse icon in duotone weight -->
53+
</p>
54+
```
55+
56+
For all available icon names and weight, visit [phosphoricons.com][phosphor].
57+
58+
The output CSS look something like this:
59+
60+
```css
61+
.ph {
62+
--ph-url: none;
63+
width: 1em;
64+
height: 1em;
65+
background-color: currentcolor;
66+
color: inherit;
67+
mask-image: var(--ph-url);
68+
mask-size: 100% 100%;
69+
mask-repeat: no-repeat;
70+
}
71+
72+
.ph-\[info\] {
73+
url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiBmaWxsPSJjdXJyZW50Q29sb3IiPjxwYXRoIGQ9Ik0xMjgsMjRBMTA0LDEwNCwwLDEsMCwyMzIsMTI4LDEwNC4xMSwxMDQuMTEsMCwwLDAsMTI4LDI0Wm0wLDE5MmE4OCw4OCwwLDEsMSw4OC04OEE4OC4xLDg4LjEsMCwwLDEsMTI4LDIxNlptMTYtNDBhOCw4LDAsMCwxLTgsOCwxNiwxNiwwLDAsMS0xNi0xNlYxMjhhOCw4LDAsMCwxLDAtMTYsMTYsMTYsMCwwLDEsMTYsMTZ2NDBBOCw4LDAsMCwxLDE0NCwxNzZaTTExMiw4NGExMiwxMiwwLDEsMSwxMiwxMkExMiwxMiwwLDAsMSwxMTIsODRaIi8+PC9zdmc+);
74+
}
75+
```
76+
77+
## Configuration
78+
79+
You may pass a configuration object to the plugin to customize the generated CSS. The following
80+
shows the default configuration:
81+
82+
```js
83+
// tailwind.config.js
84+
import phosphorIcons from "phosphor-icons-tailwindcss";
85+
86+
/** @type {import("tailwindcss").Config } */
87+
export default {
88+
plugins: [phosphorIcons({
89+
prefix: 'ph', // for the icon classes
90+
customProperty: '--ph-url',
91+
})],
92+
};
93+
```
94+
95+
Similarly, for Tailwind 4:
96+
97+
```css
98+
@import 'tailwindcss';
99+
@plugin 'phosphor-icons-tailwindcss' {
100+
prefix: ph;
101+
customProperty: --ph-url;
102+
}
103+
```
104+
105+
## Why `ph-[info]` and not `ph-info`?
106+
107+
You may notice this library utilizes Tailwind's support for [arbitrary value](https://tailwindcss.com/docs/adding-custom-styles#using-arbitrary-values), i.e `ph-[info]` instead of `ph-info` to map to the regular info icon. This is to avoid unnecessary parsing during development, especially for [Taliwind language server](https://github.com/tailwindlabs/tailwindcss-intellisense). Arbitrary value syntax allows only parsing the icons actually being used. Otherwise, parsing 9000+ icons may cause slow-down that negatively impacts developer experience.
108+
109+
## Acknowledgements
110+
111+
You may find [@iconify/tailwindcss](https://iconify.design/docs/usage/css/tailwind/) helpful if you
112+
are already using the [iconify](https://iconify.design/) ecosystem in your codebase.
113+
114+
`phosphor-icons-tailwindcss` tries to stay minimal by only covering [Phosphor] icons, and it references directly [@phosphor-icons/core](https://github.com/phosphor-icons/core) for the SVG assets.
115+
116+
[phosphor]: https://phosphoricons.com
117+
[tailwindcss]: https://tailwindcss.com
118+
<!-- header badges -->
119+
[license.badge]: https://img.shields.io/badge/license-MIT-blue.svg
120+
[license]: ./LICENSE
121+
[npm.badge]: https://img.shields.io/npm/v/phosphor-icons-tailwindcss/qr
122+
[npm]: https://www.npmjs.com/package/phosphor-icons-tailwindcss/qr

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import vnphanquang from '@vnphanquang/eslint-config';
2+
3+
export default vnphanquang;

0 commit comments

Comments
 (0)