From 5f846531a5a9a5f8f8dcc95588063d848d116795 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 5 Jan 2021 14:05:34 -0500 Subject: [PATCH] DEV: Cleanup variables/mixins SCSS imports (#11618) Prepends variables.scss and mixins.scss globally for all assets. With one notable exception, theme fields, which will be addressed in a separate PR. --- app/assets/stylesheets/color_definitions.scss | 2 -- app/assets/stylesheets/common.scss | 2 -- app/assets/stylesheets/common/admin/admin_base.scss | 2 -- app/assets/stylesheets/common/foundation/base.scss | 3 --- app/assets/stylesheets/common/input_tip.scss | 3 --- app/assets/stylesheets/embed.scss | 2 -- app/assets/stylesheets/vendor/pikaday.scss | 3 --- app/assets/stylesheets/wizard.scss | 2 -- lib/stylesheet/compiler.rb | 4 ++-- 9 files changed, 2 insertions(+), 21 deletions(-) diff --git a/app/assets/stylesheets/color_definitions.scss b/app/assets/stylesheets/color_definitions.scss index 72104d80b11..d06215d47d0 100644 --- a/app/assets/stylesheets/color_definitions.scss +++ b/app/assets/stylesheets/color_definitions.scss @@ -2,8 +2,6 @@ // It is compiled to CSS separately from the rest of the app. // The source variables come from color_transformations.scss and variables.scss -@import "common/foundation/variables"; - // this converts HEX colors to RGBs so they can be used in vanilla CSS // i.e.: rgba(var(--primary-low-rgb), 0.5) // diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 1270eff24ff..d37bc380712 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -4,8 +4,6 @@ @import "vendor/pikaday"; @import "common/foundation/helpers"; @import "common/foundation/base"; -@import "common/foundation/mixins"; -@import "common/foundation/variables"; @import "common/select-kit/_index"; @import "common/components/_index"; @import "common/input_tip"; diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 980cad669fa..f17be2880ea 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -1,7 +1,5 @@ // Styles for /admin section -@import "common/foundation/variables"; -@import "common/foundation/mixins"; @import "common/foundation/helpers"; $mobile-breakpoint: 700px; diff --git a/app/assets/stylesheets/common/foundation/base.scss b/app/assets/stylesheets/common/foundation/base.scss index 414f451c62b..cdb409a97e4 100644 --- a/app/assets/stylesheets/common/foundation/base.scss +++ b/app/assets/stylesheets/common/foundation/base.scss @@ -1,6 +1,3 @@ -@import "./variables"; -@import "./mixins"; - // -------------------------------------------------- // Base styles for HTML elements // -------------------------------------------------- diff --git a/app/assets/stylesheets/common/input_tip.scss b/app/assets/stylesheets/common/input_tip.scss index 5a37065b979..8b9e8479448 100644 --- a/app/assets/stylesheets/common/input_tip.scss +++ b/app/assets/stylesheets/common/input_tip.scss @@ -1,6 +1,3 @@ -@import "foundation/variables"; -@import "foundation/mixins"; - .popup-tip { position: absolute; display: block; diff --git a/app/assets/stylesheets/embed.scss b/app/assets/stylesheets/embed.scss index 31ab141d55c..fe8d44ea116 100644 --- a/app/assets/stylesheets/embed.scss +++ b/app/assets/stylesheets/embed.scss @@ -2,9 +2,7 @@ @import "./vendor/normalize"; @import "./vendor/normalize-ext"; @import "./common/foundation/base"; -@import "./common/foundation/variables"; @import "./color_definitions"; -@import "./common/foundation/mixins"; @import "./common/components/buttons"; article.post { diff --git a/app/assets/stylesheets/vendor/pikaday.scss b/app/assets/stylesheets/vendor/pikaday.scss index 0ec34e04405..a3f3101b756 100644 --- a/app/assets/stylesheets/vendor/pikaday.scss +++ b/app/assets/stylesheets/vendor/pikaday.scss @@ -1,6 +1,3 @@ -@import "common/foundation/variables"; -@import "common/foundation/mixins"; - /*! * Pikaday * Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/ diff --git a/app/assets/stylesheets/wizard.scss b/app/assets/stylesheets/wizard.scss index f507a1b6030..d1549ad1ea1 100644 --- a/app/assets/stylesheets/wizard.scss +++ b/app/assets/stylesheets/wizard.scss @@ -3,8 +3,6 @@ @import "vendor/normalize"; @import "vendor/normalize-ext"; @import "common/foundation/colors"; -@import "common/foundation/variables"; -@import "common/foundation/mixins"; @import "common/select-kit/_index"; @import "common/components/svg"; @import "common/base/modal"; diff --git a/lib/stylesheet/compiler.rb b/lib/stylesheet/compiler.rb index 23433e8f206..8afd78f0e20 100644 --- a/lib/stylesheet/compiler.rb +++ b/lib/stylesheet/compiler.rb @@ -9,16 +9,16 @@ module Stylesheet class Compiler def self.compile_asset(asset, options = {}) + file = "@import \"common/foundation/variables\"; @import \"common/foundation/mixins\";" if Importer.special_imports[asset.to_s] filename = "theme_#{options[:theme_id]}.scss" - file = "@import \"common/foundation/variables\"; @import \"common/foundation/mixins\";" file += " @import \"theme_variables\";" if Importer::THEME_TARGETS.include?(asset.to_s) file += " @import \"#{asset}\";" else filename = "#{asset}.scss" path = "#{Stylesheet::Common::ASSET_ROOT}/#{filename}" - file = File.read path + file += File.read path if asset.to_s == Stylesheet::Manager::COLOR_SCHEME_STYLESHEET file += Stylesheet::Importer.import_color_definitions(options[:theme_id])