Skip to content

Commit f47bf7c

Browse files
authored
Build the css without requiring the user to run Sass (#1540)
1 parent 58e6c3d commit f47bf7c

File tree

8 files changed

+54
-32
lines changed

8 files changed

+54
-32
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/pkg/
1010
/spec/reports/
1111
/tmp/
12+
/app/assets/builds/
1213

1314
# rspec failure tracking
1415
.rspec_status

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ You can also run `bin/console` for an interactive prompt that will allow you to
117117
When any of the javascript components or SASS sources in the gem are changed, this package should be published to NPM with the following steps:
118118
1. [Install npm](https://www.npmjs.com/get-npm)
119119
2. Bump the version number in `package.json`
120-
3. run `npm publish` to push the javascript package to https://npmjs.org/package/arclight
120+
3. run `npm run build && npm publish` to push the javascript package to https://npmjs.org/package/arclight
121121

122122
## Contributing
123123

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import "bootstrap/scss/functions";
2+
@import "bootstrap/scss/mixins/breakpoints";
3+
@import "bootstrap/scss/variables";
4+
@import "application";

app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss

+10-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ $hierarchy-view-collapse-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3
4848

4949
turbo-frame[busy] {
5050
&::before {
51-
@extend .placeholder !optional;
5251
animation: placeholder-glow 2s ease-in-out infinite;
53-
content: 'Loading...';
52+
background-color: currentcolor;
53+
content: "Loading...";
54+
cursor: wait;
55+
display: inline-block;
56+
min-height: 1em;
57+
opacity: 0.5;
58+
vertical-align: middle;
5459
display: inline-block;
5560
margin-left: 1.5rem;
5661
}
@@ -101,8 +106,8 @@ $hierarchy-view-collapse-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3
101106

102107
.title-container {
103108
border-bottom: $border-width solid $border-color;
104-
padding-bottom: $spacer * .5;
105-
margin-bottom: $spacer * .75;
109+
padding-bottom: $spacer * 0.5;
110+
margin-bottom: $spacer * 0.75;
106111
display: grid;
107112
gap: 0.5rem;
108113
grid-template-areas:
@@ -142,7 +147,7 @@ $hierarchy-view-collapse-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3
142147
.online-contents {
143148
grid-area: online-contents;
144149
margin-bottom: 1rem;
145-
150+
146151
h2 {
147152
font-size: 1rem;
148153
text-transform: uppercase;

app/assets/stylesheets/arclight/modules/icons.scss

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
2-
.toggle-bookmark, .breadcrumb-item, .document, .al-online-content-icon {
1+
.toggle-bookmark,
2+
.breadcrumb-item,
3+
.document,
4+
.al-online-content-icon {
35
.blacklight-icons svg {
46
height: 1rem;
57
width: 1rem;
@@ -11,5 +13,5 @@
1113
}
1214

1315
.btn > .bi:first-child {
14-
@extend .me-1
16+
margin-inline-end: 0.25rem !important;
1517
}

app/assets/stylesheets/arclight/modules/layout.scss

+19-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.al-show-breadcrumb {
88
border-bottom: $border-width solid $border-color;
99
padding-bottom: $spacer;
10-
margin-bottom: $spacer * .75;
10+
margin-bottom: $spacer * 0.75;
1111
width: 100%;
1212

1313
$bent-arrow: "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='15'><path fill-rule='evenodd' d='M1.5 1.5A.5.5 0 0 0 1 2v4.8a2.5 2.5 0 0 0 2.5 2.5h9.793l-3.347 3.346a.5.5 0 0 0 .708.708l4.2-4.2a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 8.3H3.5A1.5 1.5 0 0 1 2 6.8V2a.5.5 0 0 0-.5-.5z'></path></svg>";
@@ -53,7 +53,9 @@
5353
}
5454
}
5555

56-
.breadcrumb-item-1, .breadcrumb-item-4 { // breadcrumb-item-3 can have multiple on one line
56+
.breadcrumb-item-1,
57+
.breadcrumb-item-4 {
58+
// breadcrumb-item-3 can have multiple on one line
5759
flex: 1 0 100%;
5860
color: $gray-600;
5961
}
@@ -100,14 +102,14 @@
100102
border: $default-border-styling;
101103
background-color: $gray-200;
102104
font-size: $font-size-sm;
103-
padding: ($spacer * .5) $spacer ($spacer * .75);
105+
padding: ($spacer * 0.5) $spacer ($spacer * 0.75);
104106

105107
@media (max-width: 767px) {
106108
margin-top: $spacer;
107109
}
108110

109111
.al-collection-id {
110-
margin-bottom: $spacer * .75;
112+
margin-bottom: $spacer * 0.75;
111113
}
112114

113115
&-options {
@@ -153,12 +155,16 @@
153155
}
154156

155157
.show-document {
156-
@extend .ps-lg-4;
157-
158158
.title-container .bookmark-toggle {
159-
@extend .card;
160-
@extend .bg-light;
161-
@extend .p-2;
159+
border: var(--bs-card-border-width) solid var(--bs-card-border-color);
160+
background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity));
161+
padding: 0.5rem;
162+
}
163+
}
164+
165+
@media (min-width: 992px) {
166+
.show-document {
167+
padding-left: 1.5rem !important;
162168
}
163169
}
164170

@@ -177,7 +183,10 @@ dl.deflist dt {
177183
text-align: left;
178184
}
179185

180-
.chronlist-head, .list-head, .index-head, .table-head {
186+
.chronlist-head,
187+
.list-head,
188+
.index-head,
189+
.table-head {
181190
caption-side: top;
182191
font-size: 1.25rem;
183192
font-weight: 500;

app/assets/stylesheets/arclight/modules/search_results.scss

+10-12
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636

3737
.al-document-abstract-or-scope {
38-
margin-bottom: $spacer * .5;
38+
margin-bottom: $spacer * 0.5;
3939
max-width: 45em;
4040
}
4141
}
@@ -51,7 +51,7 @@ article.document {
5151
div.breadcrumb-links,
5252
dd.al-document-abstract-or-scope,
5353
dd.al-document-creator {
54-
margin-top: ($spacer * .5);
54+
margin-top: ($spacer * 0.5);
5555
}
5656

5757
form.bookmark-toggle.col-auto {
@@ -66,12 +66,12 @@ article.document {
6666

6767
.al-document-abstract-or-scope {
6868
margin-bottom: 0;
69-
margin-top: $spacer * .75;
69+
margin-top: $spacer * 0.75;
7070
max-width: 45em;
7171
}
7272
.al-grouped-repository {
7373
font-size: $font-size-sm;
74-
margin-bottom: $spacer * .75;
74+
margin-bottom: $spacer * 0.75;
7575
}
7676
.al-grouped-title-bar {
7777
background-color: $gray-200;
@@ -91,7 +91,7 @@ article.document {
9191
.al-grouped-more {
9292
border-bottom: $default-border-styling;
9393
margin-bottom: $spacer;
94-
padding: ($spacer * .5) 0;
94+
padding: ($spacer * 0.5) 0;
9595
}
9696

9797
.document {
@@ -121,7 +121,6 @@ article.document {
121121
margin-bottom: ($spacer * 3) !important;
122122
}
123123

124-
125124
// Compact Search Results
126125
.documents-compact {
127126
margin-bottom: $spacer;
@@ -147,7 +146,7 @@ article.document {
147146

148147
.index-document-functions {
149148
display: flex;
150-
@extend .justify-content-end;
149+
justify-content: flex-end !important;
151150
}
152151

153152
.al-document-container.text-muted {
@@ -176,13 +175,14 @@ article.document {
176175

177176
.breadcrumb-links .col {
178177
flex-basis: auto;
179-
}
178+
}
180179

181180
.btn-outline-secondary svg {
182181
fill: $gray-600;
183182
}
184183

185-
.btn-outline-secondary:not(:disabled):not(.disabled).active svg, .btn-outline-secondary:hover svg {
184+
.btn-outline-secondary:not(:disabled):not(.disabled).active svg,
185+
.btn-outline-secondary:hover svg {
186186
fill: $white;
187187
}
188188

@@ -197,11 +197,10 @@ article.document {
197197
justify-content: flex-end;
198198
}
199199

200-
201200
.result-type-group {
202201
order: -1;
203202
flex-grow: 1;
204-
&.btn-group>.btn {
203+
&.btn-group > .btn {
205204
flex-grow: 0;
206205
}
207206
}
@@ -246,6 +245,5 @@ article.document {
246245
.bookmark-toggle {
247246
display: none;
248247
}
249-
250248
}
251249
}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
"devDependencies": {
1010
"eslint": "^8.26.0",
1111
"eslint-config-airbnb-base": "^15.0.0",
12-
"eslint-plugin-import": "^2.2.0"
12+
"eslint-plugin-import": "^2.2.0",
13+
"sass": "^1.59.3",
14+
"bootstrap": "^5.2.0"
1315
},
1416
"scripts": {
17+
"build": "sass ./app/assets/stylesheets/arclight/build.scss:./app/assets/builds/arclight.css --no-source-map --load-path=node_modules",
1518
"lint": "eslint './app/assets/javascripts/**/*.{js,es6}'",
1619
"lint:fix": "eslint --fix './app/assets/javascripts/**/*.{js,es6}'",
1720
"test": "echo \"Error: no test specified\" && exit 1"

0 commit comments

Comments
 (0)