Skip to content

Commit 207951e

Browse files
committed
Version 1.0.0
0 parents  commit 207951e

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

LICENSE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Copyright 2019 Joan Piedra
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
6+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
* No Harm: The software may not be used by anyone for systems or activities that actively and knowingly endanger, harm, or otherwise threaten the physical, mental, economic, or general well-being of other individuals or groups, in violation of the United Nations Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/).
9+
10+
* Services: If the Software is used to provide a service to others, the licensee shall, as a condition of use, require those others not to use the service in any way that violates the No Harm clause above.
11+
12+
* Enforceability: If any portion or provision of this License shall to any extent be declared illegal or unenforceable by a court of competent jurisdiction, then the remainder of this License, or the application of such portion or provision in circumstances other than those as to which it is so declared illegal or unenforceable, shall not be affected thereby, and each portion and provision of this Agreement shall be valid and enforceable to the fullest extent permitted by law.
13+
14+
15+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16+
17+
This Hippocratic License is an Ethical Source license (https://ethicalsource.dev) derived from the MIT License, amended to limit the impact of the unethical use of open source software.

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<p align="center">
2+
<a href="https://tailwindcss.com/" target="_blank"><img width="200" src="https://tailwindcss.com/img/tailwind.svg"></a><br>
3+
A utility-first CSS framework for rapidly building custom user interfaces.
4+
</p>
5+
6+
---
7+
8+
<br>
9+
10+
# Tailwind CSS `!important` variant
11+
12+
This is a Tailwind CSS plugin that adds an `!important` variant.
13+
14+
Maintained by: [Joan Piedra](https://joanpiedra.com)[@neojp](https://twitter.com/neojp)
15+
16+
## Installation
17+
18+
Install as a node module with either `npm` or `yarn` on your command line
19+
20+
```bash
21+
# Install via npm
22+
npm install --save-dev @neojp/tailwindcss-important-variant
23+
24+
# Install via yarn
25+
yarn add --dev @neojp/tailwindcss-important-variant
26+
```
27+
28+
Add this module as a plugin on your [Tailwind configuration file](https://tailwindcss.com/docs/configuration#plugins) (`tailwind.config.js`).
29+
30+
```js
31+
module.exports = {
32+
plugins: [
33+
require('@neojp/tailwindcss-important-variant')
34+
]
35+
};
36+
```
37+
38+
Use this plugin in your list of [variants](https://tailwindcss.com/docs/configuring-variants), either globally
39+
40+
```js
41+
module.exports = {
42+
variants: ['responsive', 'important']
43+
};
44+
```
45+
46+
Or per utility:
47+
48+
```js
49+
module.exports = {
50+
variants: {
51+
borderRadius: ['responsive', 'important']
52+
}
53+
};
54+
```
55+
56+
## Usage
57+
58+
Use your Tailwind utility classes with an exclamation mark ( `!` ) as a suffix.
59+
60+
```html
61+
<div class="rounded!"></div>
62+
```
63+
64+
## Output
65+
66+
Tailwind will be outputed as follows.
67+
68+
```css
69+
.rounded\! {
70+
border-radius: 0.25rem !important
71+
}
72+
```
73+
74+
## Contributing
75+
76+
Feel free to submit a PR request, and send me a message on Twitter ([@neojp](https://twitter.com/neojp)) about it.
77+
78+
## License
79+
This project has been licensed under [the Hippocratic License](https://firstdonoharm.dev/).

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = function addImportantVariant({ addVariant }) {
2+
addVariant('important', ({ container }) => {
3+
container.walkRules((rule) => {
4+
rule.selector = `.${rule.selector.slice(1)}\\!`;
5+
rule.walkDecls(decl => {
6+
decl.important = true;
7+
});
8+
});
9+
});
10+
};

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@neojp/tailwindcss-important-variant",
3+
"description": "Tailwind CSS !important variant",
4+
"version": "1.0.0",
5+
"license": "SEE LICENSE IN LICENSE",
6+
"author": "Joan Piedra <[email protected]>",
7+
"main": "index.js",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+ssh://[email protected]/neojp/tailwindcss-important-variant.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/neojp/tailwindcss-important-variant/issues"
14+
},
15+
"homepage": "https://github.com/neojp/tailwindcss-important-variant#readme",
16+
"scripts": {
17+
"test": "echo \"Error: no test specified\" && exit 1"
18+
},
19+
"keywords": [
20+
"tailwindcss",
21+
"tailwindcss-plugin",
22+
"tailwindcss-important-variant",
23+
"tailwindcss-variant",
24+
"important",
25+
"variant"
26+
]
27+
}

0 commit comments

Comments
 (0)