canvas-lms/guard/compass.rb

26 lines
625 B
Ruby
Raw Normal View History

a way for accounts to opt-in to new styles and users to high-contrast fixes CNVS-11426 The UI/UX team *really* wants to start doing some major style changes to the canvas interface. Because it is a very visual change and especially because we've let people hack the crap out of canvas styles with their own css override file, any changes we do need to be behind a feature flag so an institution can opt-in when they are ready. This commit does some trickery so we actually create 4 different versions of every stylesheet. one for each variant in: legacy_normal_contrast legacy_high_contrast new_styles_normal_contrast new_styles_high_contrast and then sets the $use_new_styles and $use_high_contrast sass variables accordingly in each. now, in any sass file, you can do things like: @if $use_new_styles { background-color: red; } @else { background-color: blue; } @if not $use_high_contrast{ font-size: 12px; } test plan: * in a production (minified assets) environment, ensure you see: <link href="/assets/common_legacy_normal_contrast.css... in the <head> of the page * go to the account settings page for the domain_root_account you are on * turn on the "Use New Styles" feature * now verify that <link href="/assets/common_new_styles_normal_contrast.css... is in the <head>. There should not be any visible differences because we do not have any styles that target specifically $use_new_styles yet. * now, go to /settings and turn on the user feature for "Use High Contrast Styles" * verify that <link href="/assets/common_new_styles_high_contrast.css.. is in the <head> * again, turning that on will not actually change the way anything looks, the next commit (g/32863) will take care of that Change-Id: I45ba4ddfe780c5c819fb995b61ebfc0a5325d418 Reviewed-on: https://gerrit.instructure.com/31881 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2014-04-03 14:37:18 +08:00
require 'guard'
require 'guard/guard'
module Guard
class Compass < Guard
def initialize(watchers=[], options={})
super([::Guard::Watcher.new(/(app\/stylesheets.*)/)], {})
end
def run_on_change(paths)
# for now just recompile everything, we'll do this more optimized when we
# fix the TODO below
run_all
a way for accounts to opt-in to new styles and users to high-contrast fixes CNVS-11426 The UI/UX team *really* wants to start doing some major style changes to the canvas interface. Because it is a very visual change and especially because we've let people hack the crap out of canvas styles with their own css override file, any changes we do need to be behind a feature flag so an institution can opt-in when they are ready. This commit does some trickery so we actually create 4 different versions of every stylesheet. one for each variant in: legacy_normal_contrast legacy_high_contrast new_styles_normal_contrast new_styles_high_contrast and then sets the $use_new_styles and $use_high_contrast sass variables accordingly in each. now, in any sass file, you can do things like: @if $use_new_styles { background-color: red; } @else { background-color: blue; } @if not $use_high_contrast{ font-size: 12px; } test plan: * in a production (minified assets) environment, ensure you see: <link href="/assets/common_legacy_normal_contrast.css... in the <head> of the page * go to the account settings page for the domain_root_account you are on * turn on the "Use New Styles" feature * now verify that <link href="/assets/common_new_styles_normal_contrast.css... is in the <head>. There should not be any visible differences because we do not have any styles that target specifically $use_new_styles yet. * now, go to /settings and turn on the user feature for "Use High Contrast Styles" * verify that <link href="/assets/common_new_styles_high_contrast.css.. is in the <head> * again, turning that on will not actually change the way anything looks, the next commit (g/32863) will take care of that Change-Id: I45ba4ddfe780c5c819fb995b61ebfc0a5325d418 Reviewed-on: https://gerrit.instructure.com/31881 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2014-04-03 14:37:18 +08:00
end
def run_all
::Guard::UI.info "Forcing recompilation of all SASS files"
# TODO: get rid of this guard and watch sass in our JS based frontend watcher.
# whatever that ends up being (gulp, broccoli, etc)
`npm run compile-sass`
a way for accounts to opt-in to new styles and users to high-contrast fixes CNVS-11426 The UI/UX team *really* wants to start doing some major style changes to the canvas interface. Because it is a very visual change and especially because we've let people hack the crap out of canvas styles with their own css override file, any changes we do need to be behind a feature flag so an institution can opt-in when they are ready. This commit does some trickery so we actually create 4 different versions of every stylesheet. one for each variant in: legacy_normal_contrast legacy_high_contrast new_styles_normal_contrast new_styles_high_contrast and then sets the $use_new_styles and $use_high_contrast sass variables accordingly in each. now, in any sass file, you can do things like: @if $use_new_styles { background-color: red; } @else { background-color: blue; } @if not $use_high_contrast{ font-size: 12px; } test plan: * in a production (minified assets) environment, ensure you see: <link href="/assets/common_legacy_normal_contrast.css... in the <head> of the page * go to the account settings page for the domain_root_account you are on * turn on the "Use New Styles" feature * now verify that <link href="/assets/common_new_styles_normal_contrast.css... is in the <head>. There should not be any visible differences because we do not have any styles that target specifically $use_new_styles yet. * now, go to /settings and turn on the user feature for "Use High Contrast Styles" * verify that <link href="/assets/common_new_styles_high_contrast.css.. is in the <head> * again, turning that on will not actually change the way anything looks, the next commit (g/32863) will take care of that Change-Id: I45ba4ddfe780c5c819fb995b61ebfc0a5325d418 Reviewed-on: https://gerrit.instructure.com/31881 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2014-04-03 14:37:18 +08:00
end
end
end