cmu-web-kilt 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +114 -0
- data/VERSION +1 -0
- data/config/importmap.rb +3 -0
- data/css/cmu-app.css +2044 -0
- data/css/cmu-cms.css +1433 -0
- data/js/cmu-app.js +871 -0
- data/lib/cmu-web-kilt.rb +3 -0
- data/lib/cmu_web_kilt/engine.rb +25 -0
- data/lib/cmu_web_kilt/version.rb +21 -0
- data/lib/cmu_web_kilt.rb +4 -0
- metadata +78 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 52f2eb0ee503ee265ed34977d24ebd139f412ddab520fabcc871c0f6f254f347
|
|
4
|
+
data.tar.gz: 0e2afb0929018837572be983ad42f96757a337d0f6a032cb5f507bcc711c1193
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6769027826678ea52681305a64ce870bc9b9ef61009aa9fd898632bf70feb3e40d4d6c2f2f360ce5ecebefebe0988eb81b692899f84278d95c969246fcaf4bec
|
|
7
|
+
data.tar.gz: a82b32262f6ab5105e9ecb067b556ee02a273ff5396c3fd70628e23d746b75fe04b448ed38e38e26e41eef03aaf935043140b3e23312ee8f8499303f647a83cf
|
data/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Carnegie Mellon University
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Use the Kit in Rails
|
|
2
|
+
|
|
3
|
+
Use the asset gem when you want Rails to serve and fingerprint the kit's
|
|
4
|
+
files alongside your application's assets. It registers the stylesheets
|
|
5
|
+
and browser script and, for importmap apps, supplies a pin. Your layout
|
|
6
|
+
still loads CMU's template and decides which files to include.
|
|
7
|
+
|
|
8
|
+
The gem and its source repository are both named `cmu-web-kilt`; the gem
|
|
9
|
+
lives in the repository's `packages/rails/`. Each kit release publishes the
|
|
10
|
+
gem at the same version, with the same files the CDN serves.
|
|
11
|
+
|
|
12
|
+
## Connect Your Application
|
|
13
|
+
|
|
14
|
+
Add the gem to your application's `Gemfile`:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
gem 'cmu-web-kilt', '~> 0.6'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Run `bundle install` and restart Rails. Keep `Gemfile.lock` with your
|
|
21
|
+
application; `bundle update cmu-web-kilt` moves to a newer release.
|
|
22
|
+
|
|
23
|
+
To work on the kit and an app together, point the app at a checkout instead:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
gem 'cmu-web-kilt', path: '../cmu-web-kilt/packages/rails'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A checkout uses the kit's `css/` and `js/` at the repository root, so CSS
|
|
30
|
+
and JavaScript changes show up without building a gem. Switch back to the
|
|
31
|
+
released gem before deploying.
|
|
32
|
+
|
|
33
|
+
If the app already vendors the kit, remove the copied `cmu-cms.css`,
|
|
34
|
+
`cmu-app.css` and `cmu-app.js` files and their old includes. Matching asset
|
|
35
|
+
names can hide the gem's files, and loading the script twice installs
|
|
36
|
+
handlers twice.
|
|
37
|
+
|
|
38
|
+
## Include the Assets
|
|
39
|
+
|
|
40
|
+
Keep CMU's template first, the kit second and application styles last:
|
|
41
|
+
|
|
42
|
+
```erb
|
|
43
|
+
<link href="https://www.cmu.edu/common/standard-v6/css/main.6.7.min.css" rel="stylesheet">
|
|
44
|
+
<%= stylesheet_link_tag 'cmu-cms', 'cmu-app', 'application', 'data-turbo-track': 'reload' %>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use `cmu-app` on `<body>` for a page with the CMU header and footer, or
|
|
48
|
+
`cmu-framed` for a page embedded in another tool. The
|
|
49
|
+
[app installation guide](https://webkilt.andrew.cmu.edu/install.html#apps)
|
|
50
|
+
explains the surrounding markup and template scripts. The gem supplies
|
|
51
|
+
neither the template nor fonts or optional icon libraries.
|
|
52
|
+
|
|
53
|
+
Choose one script loading method; either way, the kit's script runs after
|
|
54
|
+
the template's scripts:
|
|
55
|
+
|
|
56
|
+
### With Importmap
|
|
57
|
+
|
|
58
|
+
Keep `javascript_importmap_tags` in the layout. In
|
|
59
|
+
`app/javascript/application.js`, after any template script import, add:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
import "cmu-web-kilt";
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The engine supplies the `cmu-web-kilt` pin for `cmu-app.js`. An application
|
|
66
|
+
pin with the same name overrides it.
|
|
67
|
+
|
|
68
|
+
### With a Script Tag
|
|
69
|
+
|
|
70
|
+
For an app without importmap, include the asset in the `<head>` with
|
|
71
|
+
`defer`:
|
|
72
|
+
|
|
73
|
+
```erb
|
|
74
|
+
<%= javascript_include_tag 'cmu-app', defer: true, 'data-turbo-track': 'reload' %>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
In the `<head>`, Turbo loads it once and keeps it from page to page; a
|
|
78
|
+
script at the end of `<body>` would run again on every Turbo visit and
|
|
79
|
+
handle each interaction twice. Deferred, it still runs after the
|
|
80
|
+
template's scripts.
|
|
81
|
+
|
|
82
|
+
This also works alongside a JavaScript bundler. The gem registers Rails
|
|
83
|
+
assets; it does not add an npm module to the bundler's dependencies.
|
|
84
|
+
|
|
85
|
+
## Verify the Integration
|
|
86
|
+
|
|
87
|
+
Run `bin/rails assets:precompile` in your app. Then open a page using the
|
|
88
|
+
kit and check that the stylesheets and script load from Rails asset URLs,
|
|
89
|
+
that the template still loads first and that a component interaction works.
|
|
90
|
+
Test both a full page load and Turbo navigation if your app uses Turbo.
|
|
91
|
+
The kit's script handles Turbo visits and pages Turbo restores from its
|
|
92
|
+
cache (0.5.0 and later).
|
|
93
|
+
|
|
94
|
+
| Symptom | Check |
|
|
95
|
+
| ------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
96
|
+
| Rails cannot find a kit asset | Confirm the bundle includes the gem, restart Rails and check that the app has an asset pipeline |
|
|
97
|
+
| An edit in the checkout has no effect | Look for an old vendored file with the same name or an include still pointing at a CDN |
|
|
98
|
+
| The import does not resolve | Check the generated importmap for `cmu-web-kilt` and any application override of that pin |
|
|
99
|
+
| An interaction happens twice | Look for both an import and a script tag, or an old copy loaded alongside the gem |
|
|
100
|
+
|
|
101
|
+
## Compatibility and Integration Coverage
|
|
102
|
+
|
|
103
|
+
The gem supports Ruby 3.2 and later with Rails 7.2 through 8.x. CI tests
|
|
104
|
+
Rails 7.2, 8.0 and 8.1 with Propshaft, on Ruby 3.2 and 3.4. The suite builds and unpacks the gem, serves its
|
|
105
|
+
assets and precompiles them, and checks importmap pins and application
|
|
106
|
+
overrides. It also checks booting without importmap or an asset pipeline.
|
|
107
|
+
Booting without a pipeline does not make asset helpers available.
|
|
108
|
+
|
|
109
|
+
The engine registers Sprockets assets too, but Sprockets is not covered by
|
|
110
|
+
the integration suite. Run your application's own precompilation and browser
|
|
111
|
+
checks when adopting the gem.
|
|
112
|
+
|
|
113
|
+
To change or build the package itself, follow
|
|
114
|
+
[Work on the Rails Package](https://github.com/cmu-web/cmu-web-kilt/blob/main/DEVELOPMENT.md#work-on-the-rails-package).
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.6.5
|
data/config/importmap.rb
ADDED