Skip to content

Commit 2fdf289

Browse files
committed
Init repository
0 parents  commit 2fdf289

File tree

5 files changed

+118
-0
lines changed

5 files changed

+118
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_STORE
2+
node_modules

index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const _ = require('lodash')
2+
3+
module.exports = function (options = {}) {
4+
return function ({ addUtilities, config, e }) {
5+
let { colors, widths, variants } = _.defaults(options, {
6+
colors: config('borderColors'),
7+
widths: config('borderWidths'),
8+
})
9+
10+
const getName = (name) => name === 'default' ? '' : `-${name}`
11+
12+
colors = _.map(colors, (color, name) => ({
13+
[`.${e(`text-fill${getName(name)}`)}`]: { '-webkit-text-fill-color': color },
14+
[`.${e(`text-stroke${getName(name)}`)}`]: { '-webkit-text-stroke-color': color },
15+
}))
16+
17+
widths = _.map(widths, (width, name) => ({
18+
[`.${e(`text-stroke${getName(name)}`)}`]: { '-webkit-text-stroke-width': width },
19+
}))
20+
21+
addUtilities(colors, variants)
22+
addUtilities(widths, variants)
23+
}
24+
}

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "tailwindcss-text-fill-stroke",
3+
"version": "0.1.0",
4+
"description": "Text-fill and text-stroke utilities for Tailwind CSS.",
5+
"main": "index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/hacknug/tailwindcss-text-fill-stroke.git"
9+
},
10+
"keywords": [
11+
"tailwind",
12+
"tailwindcss",
13+
"tailwind css",
14+
"tailwindcss-plugin",
15+
"plugin"
16+
],
17+
"author": {
18+
"name" : "Nestor Vera",
19+
"email" : "nestorvera@me.com",
20+
"url" : "https://nestor.rip/"
21+
},
22+
"license": "MIT",
23+
"bugs": {
24+
"url": "https://github.com/hacknug/tailwindcss-text-fill-stroke/issues"
25+
},
26+
"homepage": "https://github.com/hacknug/tailwindcss-text-fill-stroke#readme",
27+
"dependencies": {
28+
"lodash": "^4.17.10"
29+
}
30+
}

readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Tailwind CSS Text Indent Plugin
2+
3+
This plugin adds utilities to use text-fill and text-stroke with Tailwind CSS.
4+
5+
## Installation
6+
7+
Add this plugin to your project:
8+
9+
```bash
10+
# Install using pnpm
11+
pnpm install --save-dev tailwindcss-text-fill-stroke
12+
13+
# Install using npm
14+
npm install --save-dev tailwindcss-text-fill-stroke
15+
16+
# Install using yarn
17+
yarn add -D tailwindcss-text-fill-stroke
18+
```
19+
20+
## Usage
21+
22+
By default the plugin uses the `borderColors` and `borderWidths` properties from the config file to generate all of its classes. You can change that to whatever, just keep in mind if you have a `default` key in both objects, `.text-stroke` will set both the `-webkit-stroke-color` and `-webkit-stroke-width` of the element.
23+
24+
```js
25+
require('tailwindcss-text-fill-stroke')({
26+
colors: {
27+
'red': 'red',
28+
'blue': 'blue',
29+
'green': 'green',
30+
},
31+
widths: {
32+
default: '1px',
33+
'sm': '4px',
34+
'md': '8px',
35+
},
36+
variants: [],
37+
}),
38+
```
39+
40+
```css
41+
.text-fill-red { -webkit-text-fill-color: red; }
42+
.text-stroke-red { -webkit-text-stroke-color: red; }
43+
.text-fill-blue { -webkit-text-fill-color: blue; }
44+
.text-stroke-blue { -webkit-text-stroke-color: blue; }
45+
.text-fill-green { -webkit-text-fill-color: green; }
46+
.text-stroke-green { -webkit-text-stroke-color: green; }
47+
.text-stroke { -webkit-text-stroke-width: 1px; }
48+
.text-stroke-sm { -webkit-text-stroke-width: 4px; }
49+
.text-stroke-md { -webkit-text-stroke-width: 8px; }
50+
```

shrinkwrap.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dependencies:
2+
lodash: 4.17.10
3+
packages:
4+
/lodash/4.17.10:
5+
dev: false
6+
resolution:
7+
integrity: sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==
8+
registry: 'https://registry.npmjs.org/'
9+
shrinkwrapMinorVersion: 9
10+
shrinkwrapVersion: 3
11+
specifiers:
12+
lodash: ^4.17.10

0 commit comments

Comments
 (0)