Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

348 migrate to dart sass #2278

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ coverage
test/reports
.generators
.rakeTasks
/app/assets/builds/*
!/app/assets/builds/.keep

*.daemonette-dump
data/local_interactions.csv
config/initializers/dev_*.rb
reports/*
.byebug_history

# Local transactions import reports
removed_ghosts*.csv
ghosts*.csv
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gem "rails", "7.0.8.3"
gem "aws-sdk-s3", "~> 1"
gem "bootsnap", require: false
gem "bootstrap-kaminari-views"
gem "dartsass-rails"
gem "diffy"
gem "erb_lint"
gem "erubis"
Expand Down Expand Up @@ -34,7 +35,6 @@ gem "null_logger"
gem "plek"
gem "rails_autolink"
gem "rest-client", require: false
gem "sassc-rails"
gem "select2-rails", "~> 3.5.9" # Updating this will mean updating the styling as 4 & > have a new approach to class names.
gem "sentry-sidekiq"
gem "sprockets-rails"
Expand Down
21 changes: 13 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ GEM
bigdecimal
rexml
crass (1.0.6)
dartsass-rails (0.5.1)
railties (>= 6.0.0)
sass-embedded (~> 1.63)
database_cleaner-core (2.0.1)
database_cleaner-mongoid (2.0.1)
database_cleaner-core (~> 2.0.0)
Expand Down Expand Up @@ -723,14 +726,17 @@ GEM
sanitize (6.1.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass-embedded (1.77.8)
google-protobuf (~> 4.26)
rake (>= 13)
sass-embedded (1.77.8-aarch64-linux-gnu)
google-protobuf (~> 4.26)
sass-embedded (1.77.8-arm64-darwin)
google-protobuf (~> 4.26)
sass-embedded (1.77.8-x86_64-linux-gnu)
google-protobuf (~> 4.26)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
select2-rails (3.5.11)
selenium-webdriver (4.21.1)
base64 (~> 0.2)
Expand Down Expand Up @@ -792,7 +798,6 @@ GEM
terser (1.2.3)
execjs (>= 0.3.0, < 3)
thor (1.3.1)
tilt (2.0.10)
timecop (0.9.10)
timeout (0.4.1)
tzinfo (2.0.6)
Expand Down Expand Up @@ -832,6 +837,7 @@ DEPENDENCIES
capybara-select-2
ci_reporter_minitest
climate_control
dartsass-rails
database_cleaner-mongoid
diffy
erb_lint
Expand Down Expand Up @@ -873,7 +879,6 @@ DEPENDENCIES
rails_autolink
rest-client
rubocop-govuk
sassc-rails
select2-rails (~> 3.5.9)
sentry-sidekiq
shoulda
Expand Down
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: bin/rails server -p 3000
css: bin/rails dartsass:watch
worker: bundle exec sidekiq -C ./config/sidekiq.yml
Empty file added app/assets/builds/.keep
Empty file.
4 changes: 1 addition & 3 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//= link_tree ../images
//= link application.js
//= link application.css

//= link legacy-application.js
//= link legacy-application.css
//= link es6-components.js
//= link_tree ../builds
7 changes: 7 additions & 0 deletions app/assets/stylesheets/legacy-application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@

// GOVUK Design System
@import "govuk_publishing_components/all_components";

// Include glyphicons - still required in legacy styles but cannot be loaded from Bootstrap via Dart Sass
@font-face {
font-family: "Glyphicons Halflings";
src: url("bootstrap/glyphicons-halflings-regular.eot");
src: url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),url("bootstrap/glyphicons-halflings-regular.woff2") format("woff2"),url("bootstrap/glyphicons-halflings-regular.woff") format("woff"),url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg")
}
6 changes: 3 additions & 3 deletions app/assets/stylesheets/sortable_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
}

th .sortable {
background-image: image-url("bg.gif");
background-image: url("bg.gif");
cursor: pointer;
background-repeat: no-repeat;
background-position: center right;
padding-right: 20px;
}

th .asc {
background-image: image-url("asc.gif");
background-image: url("asc.gif");
background-color: #dddddd;
}

th .desc {
background-image: image-url("desc.gif");
background-image: url("desc.gif");
background-color: #dddddd;
}

Expand Down
6 changes: 6 additions & 0 deletions bin/dev
mtaylorgds marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
if ! gem list foreman -i --silent; then
echo "Installing foreman..."
gem install foreman
fi
exec foreman start -f Procfile.dev "$@"
3 changes: 2 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Set to false to see the latest stylesheet changes if running Sass in watch mode
config.assets.digest = false

# Suppress logger output for asset requests.
config.assets.quiet = true
Expand Down
3 changes: 0 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
# Generate digests for assets URLs.
config.assets.digest = true

# Rather than use a CSS compressor, use the SASS style to perform compression.
config.sass.style = :compressed
config.sass.line_comments = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"

Expand Down
8 changes: 8 additions & 0 deletions config/initializers/dartsass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
APP_STYLESHEETS = {
"application.scss" => "application.css",
"legacy-application.scss" => "legacy-application.css",
}.freeze

all_stylesheets = APP_STYLESHEETS.merge(GovukPublishingComponents::Config.all_stylesheets)
Rails.application.config.dartsass.builds = all_stylesheets
Rails.application.config.dartsass.build_options << " --quiet-deps"
Loading