Skip to content

Commit

Permalink
Build the css without requiring the user to run Sass
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 7, 2024
1 parent 094e10f commit 1ae67ce
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/pkg/
/spec/reports/
/tmp/
/app/assets/builds/

# rspec failure tracking
.rspec_status
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ You can also run `bin/console` for an interactive prompt that will allow you to
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:
1. [Install npm](https://www.npmjs.com/get-npm)
2. Bump the version number in `package.json`
3. run `npm publish` to push the javascript package to https://npmjs.org/package/arclight
3. run `npm run build && npm publish` to push the javascript package to https://npmjs.org/package/arclight

## Contributing

Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/arclight/build.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import "bootstrap/scss/functions";
@import "bootstrap/scss/mixins/breakpoints";
@import "bootstrap/scss/variables";
@import "application";
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ $hierarchy-view-collapse-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3

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

.title-container {
border-bottom: $border-width solid $border-color;
padding-bottom: $spacer * .5;
margin-bottom: $spacer * .75;
padding-bottom: $spacer * 0.5;
margin-bottom: $spacer * 0.75;
display: grid;
gap: 0.5rem;
grid-template-areas:
Expand Down Expand Up @@ -142,7 +147,7 @@ $hierarchy-view-collapse-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3
.online-contents {
grid-area: online-contents;
margin-bottom: 1rem;

h2 {
font-size: 1rem;
text-transform: uppercase;
Expand Down
8 changes: 5 additions & 3 deletions app/assets/stylesheets/arclight/modules/icons.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

.toggle-bookmark, .breadcrumb-item, .document, .al-online-content-icon {
.toggle-bookmark,
.breadcrumb-item,
.document,
.al-online-content-icon {
.blacklight-icons svg {
height: 1rem;
width: 1rem;
Expand All @@ -11,5 +13,5 @@
}

.btn > .bi:first-child {
@extend .me-1
margin-inline-end: 0.25rem !important;
}
29 changes: 19 additions & 10 deletions app/assets/stylesheets/arclight/modules/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.al-show-breadcrumb {
border-bottom: $border-width solid $border-color;
padding-bottom: $spacer;
margin-bottom: $spacer * .75;
margin-bottom: $spacer * 0.75;
width: 100%;

$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>";
Expand Down Expand Up @@ -53,7 +53,9 @@
}
}

.breadcrumb-item-1, .breadcrumb-item-4 { // breadcrumb-item-3 can have multiple on one line
.breadcrumb-item-1,
.breadcrumb-item-4 {
// breadcrumb-item-3 can have multiple on one line
flex: 1 0 100%;
color: $gray-600;
}
Expand Down Expand Up @@ -100,14 +102,14 @@
border: $default-border-styling;
background-color: $gray-200;
font-size: $font-size-sm;
padding: ($spacer * .5) $spacer ($spacer * .75);
padding: ($spacer * 0.5) $spacer ($spacer * 0.75);

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

.al-collection-id {
margin-bottom: $spacer * .75;
margin-bottom: $spacer * 0.75;
}

&-options {
Expand Down Expand Up @@ -153,12 +155,16 @@
}

.show-document {
@extend .ps-lg-4;

.title-container .bookmark-toggle {
@extend .card;
@extend .bg-light;
@extend .p-2;
border: var(--bs-card-border-width) solid var(--bs-card-border-color);
background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity));
padding: 0.5rem;
}
}

@media (min-width: 992px) {
.show-document {
padding-left: 1.5rem !important;
}
}

Expand All @@ -177,7 +183,10 @@ dl.deflist dt {
text-align: left;
}

.chronlist-head, .list-head, .index-head, .table-head {
.chronlist-head,
.list-head,
.index-head,
.table-head {
caption-side: top;
font-size: 1.25rem;
font-weight: 500;
Expand Down
22 changes: 10 additions & 12 deletions app/assets/stylesheets/arclight/modules/search_results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}

.al-document-abstract-or-scope {
margin-bottom: $spacer * .5;
margin-bottom: $spacer * 0.5;
max-width: 45em;
}
}
Expand All @@ -51,7 +51,7 @@ article.document {
div.breadcrumb-links,
dd.al-document-abstract-or-scope,
dd.al-document-creator {
margin-top: ($spacer * .5);
margin-top: ($spacer * 0.5);
}

form.bookmark-toggle.col-auto {
Expand All @@ -66,12 +66,12 @@ article.document {

.al-document-abstract-or-scope {
margin-bottom: 0;
margin-top: $spacer * .75;
margin-top: $spacer * 0.75;
max-width: 45em;
}
.al-grouped-repository {
font-size: $font-size-sm;
margin-bottom: $spacer * .75;
margin-bottom: $spacer * 0.75;
}
.al-grouped-title-bar {
background-color: $gray-200;
Expand All @@ -91,7 +91,7 @@ article.document {
.al-grouped-more {
border-bottom: $default-border-styling;
margin-bottom: $spacer;
padding: ($spacer * .5) 0;
padding: ($spacer * 0.5) 0;
}

.document {
Expand Down Expand Up @@ -121,7 +121,6 @@ article.document {
margin-bottom: ($spacer * 3) !important;
}


// Compact Search Results
.documents-compact {
margin-bottom: $spacer;
Expand All @@ -147,7 +146,7 @@ article.document {

.index-document-functions {
display: flex;
@extend .justify-content-end;
justify-content: flex-end !important;
}

.al-document-container.text-muted {
Expand Down Expand Up @@ -176,13 +175,14 @@ article.document {

.breadcrumb-links .col {
flex-basis: auto;
}
}

.btn-outline-secondary svg {
fill: $gray-600;
}

.btn-outline-secondary:not(:disabled):not(.disabled).active svg, .btn-outline-secondary:hover svg {
.btn-outline-secondary:not(:disabled):not(.disabled).active svg,
.btn-outline-secondary:hover svg {
fill: $white;
}

Expand All @@ -197,11 +197,10 @@ article.document {
justify-content: flex-end;
}


.result-type-group {
order: -1;
flex-grow: 1;
&.btn-group>.btn {
&.btn-group > .btn {
flex-grow: 0;
}
}
Expand Down Expand Up @@ -246,6 +245,5 @@ article.document {
.bookmark-toggle {
display: none;
}

}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
"devDependencies": {
"eslint": "^8.26.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.2.0"
"eslint-plugin-import": "^2.2.0",
"sass": "^1.59.3",
"bootstrap": "^5.2.0"
},
"scripts": {
"build": "sass ./app/assets/stylesheets/arclight/build.scss:./app/assets/builds/arclight.css --no-source-map --load-path=node_modules",
"lint": "eslint './app/assets/javascripts/**/*.{js,es6}'",
"lint:fix": "eslint --fix './app/assets/javascripts/**/*.{js,es6}'",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down

0 comments on commit 1ae67ce

Please sign in to comment.