tailwindcss-rails-cjs 2.0.25-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE-DEPENDENCIES +26 -0
- data/MIT-LICENSE +20 -0
- data/README.md +154 -0
- data/Rakefile +14 -0
- data/app/assets/fonts/Inter-italic.alternates.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.cyrillic.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.extra.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.greek.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.latin-ext.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.latin.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.symbols.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.vietnamese.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.alternates.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.cyrillic.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.extra.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.greek.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.latin-ext.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.latin.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.symbols.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.vietnamese.var.woff2 +0 -0
- data/app/assets/stylesheets/inter-font.css +194 -0
- data/exe/tailwindcss +19 -0
- data/exe/x86_64-darwin/tailwindcss +0 -0
- data/lib/generators/tailwindcss/controller/controller_generator.rb +9 -0
- data/lib/generators/tailwindcss/controller/templates/view.html.erb.tt +4 -0
- data/lib/generators/tailwindcss/mailer/mailer_generator.rb +9 -0
- data/lib/generators/tailwindcss/mailer/templates/view.html.erb.tt +5 -0
- data/lib/generators/tailwindcss/mailer/templates/view.text.erb.tt +3 -0
- data/lib/generators/tailwindcss/scaffold/scaffold_generator.rb +34 -0
- data/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +43 -0
- data/lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt +8 -0
- data/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +14 -0
- data/lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt +7 -0
- data/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt +22 -0
- data/lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt +15 -0
- data/lib/install/Procfile.dev +2 -0
- data/lib/install/application.tailwind.css +13 -0
- data/lib/install/dev +8 -0
- data/lib/install/tailwind.config.cjs +22 -0
- data/lib/install/tailwindcss.rb +56 -0
- data/lib/tailwindcss/commands.rb +81 -0
- data/lib/tailwindcss/engine.rb +17 -0
- data/lib/tailwindcss/upstream.rb +17 -0
- data/lib/tailwindcss/version.rb +3 -0
- data/lib/tailwindcss-rails.rb +7 -0
- data/lib/tasks/build.rake +26 -0
- data/lib/tasks/clobber.rake +8 -0
- data/lib/tasks/install.rake +6 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 502ec3836e37f56736674ae2725e6cd45814b6d482046603309065d788d83f4a
|
4
|
+
data.tar.gz: 5fbcd55c97931e3b2ac825022b8055018640e131a32c13a1c807d0c2f7139670
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4c74908142b112abfe81c10dc6d44eb0d686348114602284717edcad35d03cf14cadabc4087739529f3e60a374d481534c03216bceeac44db39f64898e4c924
|
7
|
+
data.tar.gz: b5130171b4b29ad9156bf4589232bc5ebf0900417d9d4dc0bbc32d421f05ced5cd9e596157ed88bc9d5960cd7d6897fa1602799875015dad8ec863687c14c775
|
@@ -0,0 +1,26 @@
|
|
1
|
+
tailwindcss-rails may redistribute executables from the https://github.com/tailwindlabs/tailwindcss project
|
2
|
+
|
3
|
+
The license for that software can be found at https://github.com/tailwindlabs/tailwindcss/blob/master/LICENSE which is reproduced here for your convenience:
|
4
|
+
|
5
|
+
MIT License
|
6
|
+
|
7
|
+
Copyright (c) Adam Wathan <adam.wathan@gmail.com>
|
8
|
+
Copyright (c) Jonathan Reinink <jonathan@reinink.ca>
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
12
|
+
in the Software without restriction, including without limitation the rights
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
15
|
+
furnished to do so, subject to the following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
+
SOFTWARE.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2020 David Heinemeier Hansson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
# Tailwind CSS for Rails
|
2
|
+
|
3
|
+
[Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
With Rails 7 you can generate a new application preconfigured with Tailwind by using `--css tailwind`. If you're adding Tailwind later, you need to:
|
8
|
+
|
9
|
+
1. Run `./bin/bundle add tailwindcss-rails`
|
10
|
+
2. Run `./bin/rails tailwindcss:install`
|
11
|
+
|
12
|
+
This gem wraps [the standalone executable version](https://tailwindcss.com/blog/standalone-cli) of the Tailwind CSS v3 framework. These executables are platform specific, so there are actually separate underlying gems per platform, but the correct gem will automatically be picked for your platform. Supported platforms are Linux x64, macOS arm64, macOS x64, and Windows x64. (Note that due to this setup, you must install the actual gems – you can't pin your gem to the github repo.)
|
13
|
+
|
14
|
+
|
15
|
+
## Developing with Tailwindcss
|
16
|
+
|
17
|
+
### Configuration
|
18
|
+
|
19
|
+
You can customize the Tailwind build through the `config/tailwind.config.js` file, just like you would if Tailwind was running in a traditional node installation. All the first-party plugins are supported.
|
20
|
+
|
21
|
+
The installer will create your Tailwind input file in `app/assets/stylesheets/application.tailwind.css`. This is where you import the plugins you want to use, and where you can setup your custom `@apply` rules. When you run `rails tailwindcss:build`, this input file will be used to generate the output in `app/assets/builds/tailwind.css`. That's the output CSS that you'll include in your app (the installer automatically configures this, alongside the Inter font as well).
|
22
|
+
|
23
|
+
|
24
|
+
### Building for production
|
25
|
+
|
26
|
+
The `tailwindcss:build` is automatically attached to `assets:precompile`, so before the asset pipeline digests the files, the Tailwind output will be generated.
|
27
|
+
|
28
|
+
|
29
|
+
### Building for testing
|
30
|
+
|
31
|
+
The `tailwindcss:build` task is automatically attached to the `test:prepare` Rake task. The `test:prepare` task is run before some test tasks (e.g. `test:all` and `test:controllers`), but not before the bare `test` task.
|
32
|
+
|
33
|
+
If your tests need Tailwind assets in your CI environment, it's best to be explicit and run this command:
|
34
|
+
|
35
|
+
```
|
36
|
+
bin/rails test:prepare test
|
37
|
+
```
|
38
|
+
|
39
|
+
### Update assets automatically
|
40
|
+
|
41
|
+
While you're developing your application, you want to run Tailwind in "watch" mode, so changes are automatically reflected in the generated CSS output. You can do this by:
|
42
|
+
|
43
|
+
- running `rails tailwindcss:watch` as a separate process,
|
44
|
+
- or by running `./bin/dev` which uses [foreman](https://github.com/ddollar/foreman) to start both the Tailwind watch process and the rails server in development mode.
|
45
|
+
|
46
|
+
If you are running `rails tailwindcss:watch` as a process in a Docker container, set `tty: true` in `docker-compose.yml` for the appropriate container to keep the watch process running.
|
47
|
+
|
48
|
+
If you are running `rails tailwindcss:watch` on a system that doesn't fully support file system events, pass a `poll` argument to the task to instruct tailwindcss to instead use polling: `rails tailwindcss:watch[poll]`. If you use `bin/dev` then you should modify your `Procfile.dev`.
|
49
|
+
|
50
|
+
|
51
|
+
### Debugging with unminified assets
|
52
|
+
|
53
|
+
If you want unminified assets, you can pass a `debug` argument to the rake task, i.e. `rails tailwindcss:build[debug]` or `rails tailwindcss:watch[debug]`.
|
54
|
+
|
55
|
+
Note that you can combine task options, e.g. `rails tailwindcss:watch[debug,poll]`.
|
56
|
+
|
57
|
+
|
58
|
+
### Custom inputs or outputs
|
59
|
+
|
60
|
+
If you need to use a custom input or output file, you can run `bundle exec tailwindcss` to access the platform-specific executable, and give it your own build options.
|
61
|
+
|
62
|
+
|
63
|
+
## Troubleshooting
|
64
|
+
|
65
|
+
Some common problems experienced by users ...
|
66
|
+
|
67
|
+
### Conflict with sassc-rails
|
68
|
+
|
69
|
+
Tailwind uses modern CSS features that are not recognized by the `sassc-rails` extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors like `SassC::SyntaxError`, you must remove that gem from your Gemfile.
|
70
|
+
|
71
|
+
### Class names must be spelled out
|
72
|
+
|
73
|
+
For Tailwind to work, your class names need to be spelled out. If you need to make sure Tailwind generates class names that don't exist in your content files or that are programmatically composed, use the [safelist option](https://tailwindcss.com/docs/content-configuration#safelisting-classes).
|
74
|
+
|
75
|
+
### ERROR: Cannot find the tailwindcss executable for <supported platform>
|
76
|
+
|
77
|
+
Some users are reporting this error even when running on one of the supported native platforms:
|
78
|
+
|
79
|
+
- arm64-darwin
|
80
|
+
- x64-mingw32
|
81
|
+
- x64-mingw-ucrt
|
82
|
+
- x86_64-darwin
|
83
|
+
- x86_64-linux
|
84
|
+
- aarch64-linux
|
85
|
+
|
86
|
+
#### Check Bundler PLATFORMS
|
87
|
+
|
88
|
+
A possible cause of this is that Bundler has not been told to include native gems for your current platform. Please check your `Gemfile.lock` file to see whether your native platform is included in the `PLATFORMS` section. If necessary, run:
|
89
|
+
|
90
|
+
``` sh
|
91
|
+
bundle lock --add-platform <platform-name>
|
92
|
+
```
|
93
|
+
|
94
|
+
and re-bundle.
|
95
|
+
|
96
|
+
|
97
|
+
#### Check BUNDLE_FORCE_RUBY_PLATFORM
|
98
|
+
|
99
|
+
Another common cause of this is that bundler is configured to always use the "ruby" platform via the
|
100
|
+
`BUNDLE_FORCE_RUBY_PLATFORM` config parameter being set to `true`. Please remove this configuration:
|
101
|
+
|
102
|
+
``` sh
|
103
|
+
bundle config unset force_ruby_platform
|
104
|
+
# or
|
105
|
+
bundle config set --local force_ruby_platform false
|
106
|
+
```
|
107
|
+
|
108
|
+
and re-bundle.
|
109
|
+
|
110
|
+
See https://bundler.io/man/bundle-config.1.html for more information.
|
111
|
+
|
112
|
+
|
113
|
+
### "No such file or directory" running on Alpine (musl)
|
114
|
+
|
115
|
+
When running `tailwindcss` on an Alpine system, some users report a "No such file or directory" error message.
|
116
|
+
|
117
|
+
|
118
|
+
#### Install gnu libc compatibility
|
119
|
+
|
120
|
+
The cause of this is the upstream `tailwindcss` binary executables being built on a gnu libc system, making them incompatible with standard musl libc systems.
|
121
|
+
|
122
|
+
A fix for this has been proposed upstream at https://github.com/tailwindlabs/tailwindcss/discussions/6785, but in the meantime a workaround is to install compatibility libraries:
|
123
|
+
|
124
|
+
``` sh
|
125
|
+
apk add build-base gcompat
|
126
|
+
```
|
127
|
+
|
128
|
+
### Using asset-pipeline assets
|
129
|
+
|
130
|
+
In Rails, you want to use [assets from the asset pipeline to get fingerprinting](https://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark). However, Tailwind isn't aware of those assets. To use assets from the pipeline, use `url(image.svg)`. [Since Sprockets v3.3.0](https://github.com/rails/sprockets-rails/pull/476) `url(image.svg)` will then automatically be rewritten to `/path/to/assets/image-7801e7538c6f1cc57aa75a5876ab0cac.svg`. So the output CSS will have the correct path to those assets.
|
131
|
+
|
132
|
+
```js
|
133
|
+
module.exports = {
|
134
|
+
theme: {
|
135
|
+
extend: {
|
136
|
+
backgroundImage: {
|
137
|
+
'image': "url('image.svg')"
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
144
|
+
The inline version also works:
|
145
|
+
|
146
|
+
```html
|
147
|
+
<section class="bg-[url('image.svg')]">Has the image as it's background</section>
|
148
|
+
```
|
149
|
+
|
150
|
+
## License
|
151
|
+
|
152
|
+
Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
|
153
|
+
Tailwind CSS is released under the [MIT License](https://opensource.org/licenses/MIT).
|
154
|
+
The Inter font is released under the [SIL Open Font License, Version 1.1](https://github.com/rsms/inter/blob/master/LICENSE.txt).
|
data/Rakefile
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,194 @@
|
|
1
|
+
/*
|
2
|
+
*= link_directory ../fonts
|
3
|
+
*/
|
4
|
+
|
5
|
+
@font-face {
|
6
|
+
font-family: 'Inter var';
|
7
|
+
font-style: italic;
|
8
|
+
font-weight: 100 900;
|
9
|
+
font-display: swap;
|
10
|
+
src: url('Inter-italic.extra.var.woff2') format('woff2');
|
11
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
12
|
+
font-named-instance: 'Italic';
|
13
|
+
}
|
14
|
+
/* alternates */
|
15
|
+
@font-face {
|
16
|
+
font-family: 'Inter var';
|
17
|
+
font-style: italic;
|
18
|
+
font-weight: 100 900;
|
19
|
+
font-display: swap;
|
20
|
+
src: url('Inter-italic.alternates.var.woff2') format('woff2');
|
21
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
22
|
+
font-named-instance: 'Italic';
|
23
|
+
}
|
24
|
+
/* symbols */
|
25
|
+
@font-face {
|
26
|
+
font-family: 'Inter var';
|
27
|
+
font-style: italic;
|
28
|
+
font-weight: 100 900;
|
29
|
+
font-display: swap;
|
30
|
+
src: url('Inter-italic.symbols.var.woff2') format('woff2');
|
31
|
+
unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852;
|
32
|
+
font-named-instance: 'Italic';
|
33
|
+
}
|
34
|
+
|
35
|
+
/* extra */
|
36
|
+
@font-face {
|
37
|
+
font-family: 'Inter var';
|
38
|
+
font-style: italic;
|
39
|
+
font-weight: 100 900;
|
40
|
+
font-display: swap;
|
41
|
+
src: url('Inter-italic.extra.var.woff2') format('woff2');
|
42
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
43
|
+
font-named-instance: 'Italic';
|
44
|
+
}
|
45
|
+
/* alternates */
|
46
|
+
@font-face {
|
47
|
+
font-family: 'Inter var';
|
48
|
+
font-style: italic;
|
49
|
+
font-weight: 100 900;
|
50
|
+
font-display: swap;
|
51
|
+
src: url('Inter-italic.alternates.var.woff2') format('woff2');
|
52
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
53
|
+
font-named-instance: 'Italic';
|
54
|
+
}
|
55
|
+
/* symbols */
|
56
|
+
@font-face {
|
57
|
+
font-family: 'Inter var';
|
58
|
+
font-style: italic;
|
59
|
+
font-weight: 100 900;
|
60
|
+
font-display: swap;
|
61
|
+
src: url('Inter-italic.symbols.var.woff2') format('woff2');
|
62
|
+
unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852;
|
63
|
+
font-named-instance: 'Italic';
|
64
|
+
}
|
65
|
+
/* cyrillic */
|
66
|
+
@font-face {
|
67
|
+
font-family: 'Inter var';
|
68
|
+
font-style: italic;
|
69
|
+
font-weight: 100 900;
|
70
|
+
font-display: swap;
|
71
|
+
src: url('Inter-italic.cyrillic.var.woff2') format('woff2');
|
72
|
+
unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F;
|
73
|
+
font-named-instance: 'Italic';
|
74
|
+
}
|
75
|
+
/* greek */
|
76
|
+
@font-face {
|
77
|
+
font-family: 'Inter var';
|
78
|
+
font-style: italic;
|
79
|
+
font-weight: 100 900;
|
80
|
+
font-display: swap;
|
81
|
+
src: url('Inter-italic.greek.var.woff2') format('woff2');
|
82
|
+
unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF;
|
83
|
+
font-named-instance: 'Italic';
|
84
|
+
}
|
85
|
+
/* vietnamese */
|
86
|
+
@font-face {
|
87
|
+
font-family: 'Inter var';
|
88
|
+
font-style: italic;
|
89
|
+
font-weight: 100 900;
|
90
|
+
font-display: swap;
|
91
|
+
src: url('Inter-italic.vietnamese.var.woff2') format('woff2');
|
92
|
+
unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB;
|
93
|
+
font-named-instance: 'Italic';
|
94
|
+
}
|
95
|
+
/* latin-ext */
|
96
|
+
@font-face {
|
97
|
+
font-family: 'Inter var';
|
98
|
+
font-style: italic;
|
99
|
+
font-weight: 100 900;
|
100
|
+
font-display: swap;
|
101
|
+
src: url('Inter-italic.latin-ext.var.woff2') format('woff2');
|
102
|
+
unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20C0,U+2113,U+2C7C,U+2C7F,U+A7FF;
|
103
|
+
font-named-instance: 'Italic';
|
104
|
+
}
|
105
|
+
/* latin */
|
106
|
+
@font-face {
|
107
|
+
font-family: 'Inter var';
|
108
|
+
font-style: italic;
|
109
|
+
font-weight: 100 900;
|
110
|
+
font-display: swap;
|
111
|
+
src: url('Inter-italic.latin.var.woff2') format('woff2');
|
112
|
+
unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF;
|
113
|
+
font-named-instance: 'Italic';
|
114
|
+
}
|
115
|
+
/* extra */
|
116
|
+
@font-face {
|
117
|
+
font-family: 'Inter var';
|
118
|
+
font-style: normal;
|
119
|
+
font-weight: 100 900;
|
120
|
+
font-display: swap;
|
121
|
+
src: url('Inter-roman.extra.var.woff2') format('woff2');
|
122
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
123
|
+
font-named-instance: 'Regular';
|
124
|
+
}
|
125
|
+
/* alternates */
|
126
|
+
@font-face {
|
127
|
+
font-family: 'Inter var';
|
128
|
+
font-style: normal;
|
129
|
+
font-weight: 100 900;
|
130
|
+
font-display: swap;
|
131
|
+
src: url('Inter-roman.alternates.var.woff2') format('woff2');
|
132
|
+
unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01,U+F6C3;
|
133
|
+
font-named-instance: 'Regular';
|
134
|
+
}
|
135
|
+
/* symbols */
|
136
|
+
@font-face {
|
137
|
+
font-family: 'Inter var';
|
138
|
+
font-style: normal;
|
139
|
+
font-weight: 100 900;
|
140
|
+
font-display: swap;
|
141
|
+
src: url('Inter-roman.symbols.var.woff2') format('woff2');
|
142
|
+
unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852;
|
143
|
+
font-named-instance: 'Regular';
|
144
|
+
}
|
145
|
+
/* cyrillic */
|
146
|
+
@font-face {
|
147
|
+
font-family: 'Inter var';
|
148
|
+
font-style: normal;
|
149
|
+
font-weight: 100 900;
|
150
|
+
font-display: swap;
|
151
|
+
src: url('Inter-roman.cyrillic.var.woff2') format('woff2');
|
152
|
+
unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F;
|
153
|
+
font-named-instance: 'Regular';
|
154
|
+
}
|
155
|
+
/* greek */
|
156
|
+
@font-face {
|
157
|
+
font-family: 'Inter var';
|
158
|
+
font-style: normal;
|
159
|
+
font-weight: 100 900;
|
160
|
+
font-display: swap;
|
161
|
+
src: url('Inter-roman.greek.var.woff2') format('woff2');
|
162
|
+
unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF;
|
163
|
+
font-named-instance: 'Regular';
|
164
|
+
}
|
165
|
+
/* vietnamese */
|
166
|
+
@font-face {
|
167
|
+
font-family: 'Inter var';
|
168
|
+
font-style: normal;
|
169
|
+
font-weight: 100 900;
|
170
|
+
font-display: swap;
|
171
|
+
src: url('Inter-roman.vietnamese.var.woff2') format('woff2');
|
172
|
+
unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB;
|
173
|
+
font-named-instance: 'Regular';
|
174
|
+
}
|
175
|
+
/* latin-ext */
|
176
|
+
@font-face {
|
177
|
+
font-family: 'Inter var';
|
178
|
+
font-style: normal;
|
179
|
+
font-weight: 100 900;
|
180
|
+
font-display: swap;
|
181
|
+
src: url('Inter-roman.latin-ext.var.woff2') format('woff2');
|
182
|
+
unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20C0,U+2113,U+2C7C,U+2C7F,U+A7FF;
|
183
|
+
font-named-instance: 'Regular';
|
184
|
+
}
|
185
|
+
/* latin */
|
186
|
+
@font-face {
|
187
|
+
font-family: 'Inter var';
|
188
|
+
font-style: normal;
|
189
|
+
font-weight: 100 900;
|
190
|
+
font-display: swap;
|
191
|
+
src: url('Inter-roman.latin.var.woff2') format('woff2');
|
192
|
+
unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF;
|
193
|
+
font-named-instance: 'Regular';
|
194
|
+
}
|
data/exe/tailwindcss
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# because rubygems shims assume a gem's executables are Ruby
|
3
|
+
|
4
|
+
require "tailwindcss/commands"
|
5
|
+
|
6
|
+
begin
|
7
|
+
command = [Tailwindcss::Commands.executable, *ARGV]
|
8
|
+
puts command.inspect
|
9
|
+
if Gem.win_platform?
|
10
|
+
# use system rather than exec as exec inexplicably fails to find the executable on Windows
|
11
|
+
# see related https://github.com/rubys/sprockets-esbuild/pull/4
|
12
|
+
system(*command, exception: true)
|
13
|
+
else
|
14
|
+
exec(*command)
|
15
|
+
end
|
16
|
+
rescue Tailwindcss::Commands::UnsupportedPlatformException, Tailwindcss::Commands::ExecutableNotFoundException => e
|
17
|
+
STDERR.puts("ERROR: " + e.message)
|
18
|
+
exit 1
|
19
|
+
end
|
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators/erb/scaffold/scaffold_generator'
|
2
|
+
require "rails/generators/resource_helpers"
|
3
|
+
|
4
|
+
module Tailwindcss
|
5
|
+
module Generators
|
6
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
7
|
+
include Rails::Generators::ResourceHelpers
|
8
|
+
|
9
|
+
source_root File.expand_path("../templates", __FILE__)
|
10
|
+
|
11
|
+
argument :attributes, type: :array, default: [], banner: "field:type field:type"
|
12
|
+
|
13
|
+
def create_root_folder
|
14
|
+
empty_directory File.join("app/views", controller_file_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def copy_view_files
|
18
|
+
available_views.each do |view|
|
19
|
+
formats.each do |format|
|
20
|
+
filename = filename_with_extensions(view, format)
|
21
|
+
template filename, File.join("app/views", controller_file_path, filename)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
template "partial.html.erb", File.join("app/views", controller_file_path, "_#{singular_name}.html.erb")
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def available_views
|
30
|
+
%w(index edit show new _form)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%%= form_with(model: <%= model_resource_name %>, class: "contents") do |form| %>
|
2
|
+
<%% if <%= singular_table_name %>.errors.any? %>
|
3
|
+
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
|
4
|
+
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<%% <%= singular_table_name %>.errors.each do |error| %>
|
8
|
+
<li><%%= error.full_message %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<%% end %>
|
13
|
+
|
14
|
+
<% attributes.each do |attribute| -%>
|
15
|
+
<div class="my-5">
|
16
|
+
<% if attribute.password_digest? -%>
|
17
|
+
<%%= form.label :password %>
|
18
|
+
<%%= form.password_field :password %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="my-5">
|
22
|
+
<%%= form.label :password_confirmation %>
|
23
|
+
<%%= form.password_field :password_confirmation, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
|
24
|
+
<% elsif attribute.attachments? -%>
|
25
|
+
<%%= form.label :<%= attribute.column_name %> %>
|
26
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
|
27
|
+
<% else -%>
|
28
|
+
<%%= form.label :<%= attribute.column_name %> %>
|
29
|
+
<% if attribute.field_type == :text_area -%>
|
30
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
|
31
|
+
<% elsif attribute.field_type == :check_box -%>
|
32
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block mt-2 h-5 w-5" %>
|
33
|
+
<% else -%>
|
34
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
|
35
|
+
<% end -%>
|
36
|
+
<% end -%>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<% end -%>
|
40
|
+
<div class="inline">
|
41
|
+
<%%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
42
|
+
</div>
|
43
|
+
<%% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="mx-auto md:w-2/3 w-full">
|
2
|
+
<h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1>
|
3
|
+
|
4
|
+
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
5
|
+
|
6
|
+
<%%= link_to "Show this <%= human_name.downcase %>", @<%= singular_table_name %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
7
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
8
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="w-full">
|
2
|
+
<%% if notice.present? %>
|
3
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
|
4
|
+
<%% end %>
|
5
|
+
|
6
|
+
<div class="flex justify-between items-center">
|
7
|
+
<h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1>
|
8
|
+
<%%= link_to 'New <%= human_name.downcase %>', new_<%= singular_route_name %>_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div id="<%= plural_table_name %>" class="min-w-full">
|
12
|
+
<%%= render @<%= plural_table_name %> %>
|
13
|
+
</div>
|
14
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="mx-auto md:w-2/3 w-full">
|
2
|
+
<h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1>
|
3
|
+
|
4
|
+
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
5
|
+
|
6
|
+
<%%= link_to 'Back to <%= human_name.pluralize.downcase %>', <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
7
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div id="<%%= dom_id <%= singular_name %> %>">
|
2
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
3
|
+
<p class="my-5">
|
4
|
+
<strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>
|
5
|
+
<% if attribute.attachment? -%>
|
6
|
+
<%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
|
7
|
+
<% elsif attribute.attachments? -%>
|
8
|
+
<%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
|
9
|
+
<div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
|
10
|
+
<%% end %>
|
11
|
+
<% else -%>
|
12
|
+
<%%= <%= singular_name %>.<%= attribute.column_name %> %>
|
13
|
+
<% end -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<% end -%>
|
17
|
+
<%% if action_name != "show" %>
|
18
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %>, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
19
|
+
<%%= link_to 'Edit this <%= human_name.downcase %>', edit_<%= singular_name %>_path(<%= singular_name %>), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
|
20
|
+
<hr class="mt-6">
|
21
|
+
<%% end %>
|
22
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="mx-auto md:w-2/3 w-full flex">
|
2
|
+
<div class="mx-auto">
|
3
|
+
<%% if notice.present? %>
|
4
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
|
5
|
+
<%% end %>
|
6
|
+
|
7
|
+
<%%= render @<%= singular_table_name %> %>
|
8
|
+
|
9
|
+
<%%= link_to 'Edit this <%= singular_table_name %>', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
10
|
+
<div class="inline-block ml-2">
|
11
|
+
<%%= button_to 'Destroy this <%= singular_table_name %>', <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
|
12
|
+
</div>
|
13
|
+
<%%= link_to 'Back to <%= plural_table_name %>', <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
14
|
+
</div>
|
15
|
+
</div>
|
data/lib/install/dev
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
content: [
|
5
|
+
'./public/*.html',
|
6
|
+
'./app/helpers/**/*.rb',
|
7
|
+
'./app/javascript/**/*.js',
|
8
|
+
'./app/views/**/*.{erb,haml,html,slim}'
|
9
|
+
],
|
10
|
+
theme: {
|
11
|
+
extend: {
|
12
|
+
fontFamily: {
|
13
|
+
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
14
|
+
},
|
15
|
+
},
|
16
|
+
},
|
17
|
+
plugins: [
|
18
|
+
require('@tailwindcss/forms'),
|
19
|
+
require('@tailwindcss/aspect-ratio'),
|
20
|
+
require('@tailwindcss/typography'),
|
21
|
+
]
|
22
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
|
2
|
+
CENTERING_CONTAINER_INSERTION_POINT = /^\s*<%= yield %>/.freeze
|
3
|
+
|
4
|
+
if APPLICATION_LAYOUT_PATH.exist?
|
5
|
+
say "Add Tailwindcss include tags and container element in application layout"
|
6
|
+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, <<~ERB.indent(4), before: /^\s*<%= stylesheet_link_tag/
|
7
|
+
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
|
8
|
+
ERB
|
9
|
+
|
10
|
+
if File.open(APPLICATION_LAYOUT_PATH).read =~ /<body>\n\s*<%= yield %>\n\s*<\/body>/
|
11
|
+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %( <main class="container mx-auto mt-28 px-5 flex">\n ), before: CENTERING_CONTAINER_INSERTION_POINT
|
12
|
+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n </main>), after: CENTERING_CONTAINER_INSERTION_POINT
|
13
|
+
end
|
14
|
+
else
|
15
|
+
say "Default application.html.erb is missing!", :red
|
16
|
+
say %( Add <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
|
17
|
+
end
|
18
|
+
|
19
|
+
say "Build into app/assets/builds"
|
20
|
+
empty_directory "app/assets/builds"
|
21
|
+
keep_file "app/assets/builds"
|
22
|
+
|
23
|
+
if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist?
|
24
|
+
append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n)
|
25
|
+
end
|
26
|
+
|
27
|
+
if Rails.root.join(".gitignore").exist?
|
28
|
+
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
|
29
|
+
end
|
30
|
+
|
31
|
+
unless Rails.root.join("config/tailwind.config.cjs").exist?
|
32
|
+
say "Add default config/tailwindcss.config.cjs"
|
33
|
+
copy_file "#{__dir__}/tailwind.config.cjs", "config/tailwind.config.cjs"
|
34
|
+
end
|
35
|
+
|
36
|
+
unless Rails.root.join("app/assets/stylesheets/application.tailwind.css").exist?
|
37
|
+
say "Add default app/assets/stylesheets/application.tailwind.css"
|
38
|
+
copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css"
|
39
|
+
end
|
40
|
+
|
41
|
+
if Rails.root.join("Procfile.dev").exist?
|
42
|
+
append_to_file "Procfile.dev", "css: bin/rails tailwindcss:watch\n"
|
43
|
+
else
|
44
|
+
say "Add default Procfile.dev"
|
45
|
+
copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
|
46
|
+
|
47
|
+
say "Ensure foreman is installed"
|
48
|
+
run "gem install foreman"
|
49
|
+
end
|
50
|
+
|
51
|
+
say "Add bin/dev to start foreman"
|
52
|
+
copy_file "#{__dir__}/dev", "bin/dev"
|
53
|
+
chmod "bin/dev", 0755, verbose: false
|
54
|
+
|
55
|
+
say "Compile initial Tailwind build"
|
56
|
+
run "rails tailwindcss:build"
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require_relative "upstream"
|
2
|
+
|
3
|
+
module Tailwindcss
|
4
|
+
module Commands
|
5
|
+
# raised when the host platform is not supported by upstream tailwindcss's binary releases
|
6
|
+
class UnsupportedPlatformException < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
# raised when the tailwindcss executable could not be found where we expected it to be
|
10
|
+
class ExecutableNotFoundException < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def platform
|
15
|
+
[:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
|
16
|
+
end
|
17
|
+
|
18
|
+
def executable(
|
19
|
+
exe_path: File.expand_path(File.join(__dir__, "..", "..", "exe"))
|
20
|
+
)
|
21
|
+
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(Gem::Platform.new(p)) }
|
22
|
+
raise UnsupportedPlatformException, <<~MESSAGE
|
23
|
+
tailwindcss-rails does not support the #{platform} platform
|
24
|
+
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
|
25
|
+
MESSAGE
|
26
|
+
end
|
27
|
+
|
28
|
+
exe_path = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
|
29
|
+
Gem::Platform.match(Gem::Platform.new(File.basename(File.dirname(f))))
|
30
|
+
end
|
31
|
+
|
32
|
+
if exe_path.nil?
|
33
|
+
raise ExecutableNotFoundException, <<~MESSAGE
|
34
|
+
Cannot find the tailwindcss executable for #{platform} in #{exe_path}
|
35
|
+
|
36
|
+
If you're using bundler, please make sure you're on the latest bundler version:
|
37
|
+
|
38
|
+
gem install bundler
|
39
|
+
bundle update --bundler
|
40
|
+
|
41
|
+
Then make sure your lock file includes this platform by running:
|
42
|
+
|
43
|
+
bundle lock --add-platform #{platform}
|
44
|
+
bundle install
|
45
|
+
|
46
|
+
See `bundle lock --help` output for details.
|
47
|
+
|
48
|
+
If you're still seeing this message after taking those steps, try running
|
49
|
+
`bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
|
50
|
+
https://github.com/rails/tailwindcss-rails#check-bundle_force_ruby_platform
|
51
|
+
for more details.
|
52
|
+
MESSAGE
|
53
|
+
end
|
54
|
+
|
55
|
+
exe_path
|
56
|
+
end
|
57
|
+
|
58
|
+
def compile_command(debug: false, **kwargs)
|
59
|
+
[
|
60
|
+
executable(**kwargs),
|
61
|
+
"-i", Rails.root.join("app/assets/stylesheets/application.tailwind.css").to_s,
|
62
|
+
"-o", Rails.root.join("app/assets/builds/tailwind.css").to_s,
|
63
|
+
"-c", Rails.root.join("config/tailwind.config.cjs").to_s,
|
64
|
+
].tap do |command|
|
65
|
+
command << "--minify" unless (debug || rails_css_compressor?)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def watch_command(poll: false, **kwargs)
|
70
|
+
compile_command(**kwargs).tap do |command|
|
71
|
+
command << "-w"
|
72
|
+
command << "-p" if poll
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def rails_css_compressor?
|
77
|
+
defined?(Rails) && Rails&.application&.config&.assets&.css_compressor.present?
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rails"
|
2
|
+
|
3
|
+
module Tailwindcss
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
initializer "tailwindcss.assets" do
|
6
|
+
Rails.application.config.assets.precompile += %w( inter-font.css )
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer "tailwindcss.disable_generator_stylesheets" do
|
10
|
+
Rails.application.config.generators.stylesheets = false
|
11
|
+
end
|
12
|
+
|
13
|
+
config.app_generators do |g|
|
14
|
+
g.template_engine :tailwindcss
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Tailwindcss
|
2
|
+
# constants describing the upstream tailwindcss project
|
3
|
+
module Upstream
|
4
|
+
VERSION = "v3.2.7"
|
5
|
+
|
6
|
+
# rubygems platform name => upstream release filename
|
7
|
+
NATIVE_PLATFORMS = {
|
8
|
+
"arm64-darwin" => "tailwindcss-macos-arm64",
|
9
|
+
"x64-mingw32" => "tailwindcss-windows-x64.exe",
|
10
|
+
"x64-mingw-ucrt" => "tailwindcss-windows-x64.exe",
|
11
|
+
"x86_64-darwin" => "tailwindcss-macos-x64",
|
12
|
+
"x86_64-linux" => "tailwindcss-linux-x64",
|
13
|
+
"aarch64-linux" => "tailwindcss-linux-arm64",
|
14
|
+
"arm-linux" => "tailwindcss-linux-armv7",
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
namespace :tailwindcss do
|
2
|
+
desc "Build your Tailwind CSS"
|
3
|
+
task build: :environment do |_, args|
|
4
|
+
debug = args.extras.include?("debug")
|
5
|
+
command = Tailwindcss::Commands.compile_command(debug: debug)
|
6
|
+
puts command.inspect if args.extras.include?("verbose")
|
7
|
+
system(*command, exception: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Watch and build your Tailwind CSS on file changes"
|
11
|
+
task watch: :environment do |_, args|
|
12
|
+
debug = args.extras.include?("debug")
|
13
|
+
poll = args.extras.include?("poll")
|
14
|
+
command = Tailwindcss::Commands.watch_command(debug: debug, poll: poll)
|
15
|
+
puts command.inspect if args.extras.include?("verbose")
|
16
|
+
system(*command)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])
|
21
|
+
|
22
|
+
if Rake::Task.task_defined?("test:prepare")
|
23
|
+
Rake::Task["test:prepare"].enhance(["tailwindcss:build"])
|
24
|
+
elsif Rake::Task.task_defined?("db:test:prepare")
|
25
|
+
Rake::Task["db:test:prepare"].enhance(["tailwindcss:build"])
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tailwindcss-rails-cjs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.25
|
5
|
+
platform: x86_64-darwin
|
6
|
+
authors:
|
7
|
+
- David Heinemeier Hansson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.0.0
|
27
|
+
description:
|
28
|
+
email: david@loudthinking.com
|
29
|
+
executables:
|
30
|
+
- tailwindcss
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- LICENSE-DEPENDENCIES
|
35
|
+
- MIT-LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- app/assets/fonts/Inter-italic.alternates.var.woff2
|
39
|
+
- app/assets/fonts/Inter-italic.cyrillic.var.woff2
|
40
|
+
- app/assets/fonts/Inter-italic.extra.var.woff2
|
41
|
+
- app/assets/fonts/Inter-italic.greek.var.woff2
|
42
|
+
- app/assets/fonts/Inter-italic.latin-ext.var.woff2
|
43
|
+
- app/assets/fonts/Inter-italic.latin.var.woff2
|
44
|
+
- app/assets/fonts/Inter-italic.symbols.var.woff2
|
45
|
+
- app/assets/fonts/Inter-italic.vietnamese.var.woff2
|
46
|
+
- app/assets/fonts/Inter-roman.alternates.var.woff2
|
47
|
+
- app/assets/fonts/Inter-roman.cyrillic.var.woff2
|
48
|
+
- app/assets/fonts/Inter-roman.extra.var.woff2
|
49
|
+
- app/assets/fonts/Inter-roman.greek.var.woff2
|
50
|
+
- app/assets/fonts/Inter-roman.latin-ext.var.woff2
|
51
|
+
- app/assets/fonts/Inter-roman.latin.var.woff2
|
52
|
+
- app/assets/fonts/Inter-roman.symbols.var.woff2
|
53
|
+
- app/assets/fonts/Inter-roman.vietnamese.var.woff2
|
54
|
+
- app/assets/stylesheets/inter-font.css
|
55
|
+
- exe/tailwindcss
|
56
|
+
- exe/x86_64-darwin/tailwindcss
|
57
|
+
- lib/generators/tailwindcss/controller/controller_generator.rb
|
58
|
+
- lib/generators/tailwindcss/controller/templates/view.html.erb.tt
|
59
|
+
- lib/generators/tailwindcss/mailer/mailer_generator.rb
|
60
|
+
- lib/generators/tailwindcss/mailer/templates/view.html.erb.tt
|
61
|
+
- lib/generators/tailwindcss/mailer/templates/view.text.erb.tt
|
62
|
+
- lib/generators/tailwindcss/scaffold/scaffold_generator.rb
|
63
|
+
- lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt
|
64
|
+
- lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt
|
65
|
+
- lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt
|
66
|
+
- lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt
|
67
|
+
- lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
|
68
|
+
- lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt
|
69
|
+
- lib/install/Procfile.dev
|
70
|
+
- lib/install/application.tailwind.css
|
71
|
+
- lib/install/dev
|
72
|
+
- lib/install/tailwind.config.cjs
|
73
|
+
- lib/install/tailwindcss.rb
|
74
|
+
- lib/tailwindcss-rails.rb
|
75
|
+
- lib/tailwindcss/commands.rb
|
76
|
+
- lib/tailwindcss/engine.rb
|
77
|
+
- lib/tailwindcss/upstream.rb
|
78
|
+
- lib/tailwindcss/version.rb
|
79
|
+
- lib/tasks/build.rake
|
80
|
+
- lib/tasks/clobber.rake
|
81
|
+
- lib/tasks/install.rake
|
82
|
+
homepage: https://github.com/emerson-argueta/tailwindcss-rails
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/emerson-argueta/tailwindcss-rails
|
87
|
+
rubygems_mfa_required: 'true'
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.3.7
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Integrate Tailwind CSS with the asset pipeline in Rails.
|
107
|
+
test_files: []
|