Skip to content

Commit fbb066c

Browse files
committed
Init repository
0 parents  commit fbb066c

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_STORE
2+
node_modules

index.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const _ = require('lodash')
2+
3+
module.exports = function ({ indents, variants }) {
4+
return function ({ addUtilities, e }) {
5+
const utilities = _.map(indents, (size, name) => ({
6+
[`.${size.charAt(0) === '-' ? '-' : ''}indent-${name}`]: {
7+
textIndent: size,
8+
},
9+
}))
10+
11+
addUtilities(utilities, variants)
12+
}
13+
}

package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "tailwindcss-text-indent",
3+
"version": "0.1.0",
4+
"description": "This plugin adds utilities to use text-indent with Tailwind CSS.",
5+
"main": "index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/hacknug/tailwindcss-text-indent.git"
9+
},
10+
"keywords": [
11+
"tailwind",
12+
"tailwindcss",
13+
"tailwind css",
14+
"tailwindcss-plugin",
15+
"plugin"
16+
],
17+
"author": "Nestor Vera <[email protected]> (https://nestor.rip)",
18+
"license": "MIT",
19+
"bugs": {
20+
"url": "https://github.com/hacknug/tailwindcss-text-indent/issues"
21+
},
22+
"homepage": "https://github.com/hacknug/tailwindcss-text-indent#readme",
23+
"dependencies": {
24+
"lodash": "^4.17.10"
25+
}
26+
}

readme.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Tailwind CSS Text Indent Plugin
2+
3+
This plugin adds utilities to use text-indent with Tailwind CSS.
4+
5+
## Installation
6+
7+
Add this plugin to your project:
8+
9+
```bash
10+
# Install using npm
11+
npm install --save-dev tailwindcss-text-indent
12+
13+
# Install using yarn
14+
yarn add -D tailwindcss-text-indent
15+
```
16+
17+
## Usage
18+
19+
Because the plugin preprends a dash to the class name when the value is negative, if you want both positive and negative classes to share the same name, you'll have to require the plugin twice. If you have a better idea on how to deal with this, feel free to open an issue to discuss it.
20+
21+
```js
22+
require('tailwindcss-text-indent')({
23+
indents: {
24+
'sm': '2rem',
25+
'md': '3rem',
26+
'lg': '4rem',
27+
},
28+
variants: ['responsive'],
29+
})
30+
require('tailwindcss-text-indent')({
31+
indents: {
32+
'sm': '-2rem',
33+
'md': '-3rem',
34+
'lg': '-4rem',
35+
},
36+
variants: ['responsive'],
37+
})
38+
```
39+
40+
```css
41+
.indent-sm { text-indent: 2rem; }
42+
.indent-md { text-indent: 3rem; }
43+
.indent-lg { text-indent: 4rem; }
44+
.-indent-sm { text-indent: -2rem; }
45+
.-indent-md { text-indent: -3rem; }
46+
.-indent-lg { text-indent: -4rem; }
47+
```

yarn.lock

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
lodash@^4.17.10:
6+
version "4.17.10"
7+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"

0 commit comments

Comments
 (0)