Skip to content

Commit 0251107

Browse files
committed
Update readme
1 parent 63eda62 commit 0251107

File tree

1 file changed

+4
-184
lines changed

1 file changed

+4
-184
lines changed

README.md

Lines changed: 4 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,187 +1,7 @@
1-
# TailwindCSS
1+
# Tailwind CSS
22

3-
A utility-first CSS framework for rapid UI development.
3+
A utility-first CSS framework for rapidly building custom user interfaces.
44

5-
## Getting Started
5+
## Documentation
66

7-
1. Add the library to your project as a Git repo dependency:
8-
9-
```sh
10-
# Using npm
11-
npm install git+ssh://[email protected]:nothingworksinc/tailwindcss.git#master
12-
13-
# Using Yarn
14-
yarn add git+ssh://[email protected]:nothingworksinc/tailwindcss.git#master
15-
```
16-
17-
2. Create a Tailwind config file for your project by saving a copy of the default config file somewhere sensible, like `tailwind.js` in your project's root.
18-
19-
You can copy the default config file from here:
20-
21-
https://github.com/nothingworksinc/tailwindcss/blob/master/src/defaultConfig.js
22-
23-
3. Create a CSS (or Less, Sass, Stylus, whatever) file as your main stylesheet, structured like this:
24-
25-
```less
26-
/**
27-
* This injects Tailwind's base styles, which is a combination of
28-
* Normalize.css and some additional base styles.
29-
*
30-
* You can see the styles here:
31-
* https://github.com/nothingworksinc/tailwindcss/blob/master/css/preflight.css
32-
*/
33-
@tailwind preflight;
34-
35-
/**
36-
* Here you would import any custom component classes; stuff that you'd
37-
* want loaded *before* the utilities so that the utilities can still
38-
* override them.
39-
*/
40-
@import "my-components/foo";
41-
@import "my-components/bar";
42-
43-
/**
44-
* This injects all of Tailwind's utility classes, generated based on your
45-
* config file.
46-
*/
47-
@tailwind utilities;
48-
49-
/**
50-
* Here you would add any custom utilities you need that don't come out of the box with Tailwind.
51-
*/
52-
.bg-hero-image {
53-
background-image: url('/some/image/file.png');
54-
}
55-
```
56-
57-
4. For simple projects or just taking Tailwind for a spin, use the `tailwind` CLI tool to process your CSS:
58-
59-
```sh
60-
./node_modules/.bin/tailwind styles.css [-c ./custom-config.js] [-o ./output.css]
61-
```
62-
63-
For most projects, you'll want to add Tailwind as a PostCSS plugin in your build chain, passing your config object as a parameter.
64-
65-
Here's an example using Laravel Mix:
66-
67-
```js
68-
const mix = require('laravel-mix');
69-
const tailwind = require('tailwindcss');
70-
71-
mix.less('resources/assets/less/app.less', 'public/css')
72-
.options({
73-
postCss: [
74-
tailwind(require('./path/to/your/tailwind/config.js'))
75-
]
76-
});
77-
```
78-
79-
## Style Reference
80-
81-
Until the real documentation is ready, you can reference this file to see which classes exist and what they do:
82-
83-
https://github.com/nothingworksinc/tailwindcss/blob/master/dist/tailwind.css
84-
85-
## Additional Features
86-
87-
### Using utilities as mixins
88-
89-
To use existing utility classes as mixins in your custom component classes, use the `@apply` custom at-rule:
90-
91-
```less
92-
// Input
93-
.btn-primary {
94-
@apply .bg-blue;
95-
@apply .px-4;
96-
@apply .py-2;
97-
@apply .text-white;
98-
}
99-
.btn-primary:hover {
100-
@apply .bg-blue-dark;
101-
}
102-
103-
// Output
104-
.btn-primary {
105-
background-color: #4aa2ea;
106-
padding-left: 1rem;
107-
padding-right: 1rem;
108-
padding-top: .5rem;
109-
padding-bottom: .5rem;
110-
color: #fff;
111-
}
112-
.btn-primary:hover {
113-
background-color: #3687c8;
114-
}
115-
```
116-
117-
118-
### Referencing config values in your CSS
119-
120-
It's not always possible to build components purely out of existing utilities. If you need to reference any of your Tailwind config values directly, you can do so with the `tailwind(...)` helper function:
121-
122-
```less
123-
.markdown pre {
124-
border: 1px solid tailwind('borders.defaults.color');
125-
border-left: 4px solid tailwind('borders.colors.dark');
126-
}
127-
```
128-
129-
### Creating responsive versions of your own utilities
130-
131-
You can generate responsive versions of your own utilities by wrapping their definitions in the `@responsive` at-rule:
132-
133-
```css
134-
@responsive {
135-
.bg-gradient-brand {
136-
background-image: linear-gradient(blue, green);
137-
}
138-
}
139-
```
140-
141-
This will generate these classes (assuming you haven't changed the default breakpoints):
142-
143-
```css
144-
.bg-gradient-brand {
145-
background-image: linear-gradient(blue, green);
146-
}
147-
@media (min-width: 576px) {
148-
.sm\:bg-gradient-brand {
149-
background-image: linear-gradient(blue, green);
150-
}
151-
}
152-
@media (min-width: 768px) {
153-
.md\:bg-gradient-brand {
154-
background-image: linear-gradient(blue, green);
155-
}
156-
}
157-
@media (min-width: 992px) {
158-
.lg\:bg-gradient-brand {
159-
background-image: linear-gradient(blue, green);
160-
}
161-
}
162-
@media (min-width: 1200px) {
163-
.xl\:bg-gradient-brand {
164-
background-image: linear-gradient(blue, green);
165-
}
166-
}
167-
```
168-
169-
### Media query shorthand
170-
171-
Say you have a `sm` breakpoint at 576px, and you need to write some custom CSS that references this breakpoint.
172-
173-
Instead of duplicating the values like this:
174-
175-
```css
176-
@media (min-width: 576px) {
177-
/* ... */
178-
}
179-
```
180-
181-
...you can use the `@screen` at-rule and pass the breakpoint name:
182-
183-
```css
184-
@screen sm {
185-
/* ... */
186-
}
187-
```
7+
For full documentation, visit: https://tailwindcss.com/

0 commit comments

Comments
 (0)