Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Add setting to silence all deprecation warnings
Browse files Browse the repository at this point in the history
Closes #204
  • Loading branch information
Reda Lemeden committed Aug 1, 2014
1 parent e1b5e6e commit 5c337cc
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 24 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/_neat-helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
// Settings
@import "settings/grid";
@import "settings/visual-grid";
@import "settings/disable-warnings";
1 change: 0 additions & 1 deletion app/assets/stylesheets/_neat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

// Grid
@import "grid/private";
@import "grid/reset";
@import "grid/box-sizing";
@import "grid/omega";
@import "grid/outer-container";
Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/grid/_omega.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
$auto: if(belongs-to(auto, $query), true, false);

@if $direction != default {
@warn "The omega mixin will no longer take a $direction argument. To change the layout direction, use row($direction) or set $default-layout-direction instead."
@include -neat-warn("The omega mixin will no longer take a $direction argument. To change the layout direction, use the direction(){...} mixin.");
} @else {
$direction: get-direction($layout-direction, $default-layout-direction);
}

@if $table {
@warn "The omega mixin no longer removes padding in table layouts."
@include -neat-warn("The omega mixin no longer removes padding in table layouts.");
}

@if length($query) == 1 {
Expand Down Expand Up @@ -42,7 +42,7 @@
}

@else {
@warn "Too many arguments passed to the omega() mixin."
@include -neat-warn("Too many arguments passed to the omega() mixin.");
}
}

Expand Down
14 changes: 0 additions & 14 deletions app/assets/stylesheets/grid/_reset.scss

This file was deleted.

4 changes: 2 additions & 2 deletions app/assets/stylesheets/grid/_row.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@mixin row($display: default, $direction: $default-layout-direction) {
@if $direction != $default-layout-direction {
@warn "The $direction argument will be deprecated in future versions in favor of the direction(){...} mixin."
@include -neat-warn("The $direction argument will be deprecated in future versions in favor of the direction(){...} mixin.");
}

$layout-direction: $direction !global;

@if $display != default {
@warn "The $display argument will be deprecated in future versions in favor of the display(){...} mixin."
@include -neat-warn("The $display argument will be deprecated in future versions in favor of the display(){...} mixin.");
}

@if $display == table {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/grid/_span-columns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

@if $display == collapse {
@warn "The 'collapse' argument will be deprecated. Use 'block-collapse' instead."
@include -neat-warn("The 'collapse' argument will be deprecated. Use 'block-collapse' instead.");
}

@if $display == collapse or $display == block-collapse {
Expand Down
21 changes: 18 additions & 3 deletions app/assets/stylesheets/grid/_to-deprecate.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@mixin breakpoint($query:$feature $value $columns, $total-columns: $grid-columns) {
@warn "The breakpoint() mixin was renamed to media() in Neat 1.0. Please update your project with the new syntax before the next version bump.";
@include -neat-warn("The breakpoint() mixin was renamed to media() in Neat 1.0. Please update your project with the new syntax before the next version bump.");

@if length($query) == 1 {
@media screen and ($default-feature: nth($query, 1)) {
Expand Down Expand Up @@ -47,11 +47,26 @@
}

@else {
@warn "Wrong number of arguments for breakpoint(). Read the documentation for more details.";
@include -neat-warn("Wrong number of arguments for breakpoint(). Read the documentation for more details.");
}
}

@mixin nth-omega($nth, $display: block, $direction: default) {
@warn "The nth-omega() mixin is deprecated. Please use omega() instead.";
@include -neat-warn("The nth-omega() mixin is deprecated. Please use omega() instead.");
@include omega($nth $display, $direction);
}

@mixin reset-display {
$container-display-table: false !global;
@include -neat-warn("Resetting $display will be deprecated in future versions in favor of the display(){...} mixin.");
}

@mixin reset-layout-direction {
$layout-direction: $default-layout-direction !global;
@include -neat-warn("Resetting $direction will be deprecated in future versions in favor of the direction(){...} mixin.");
}

@mixin reset-all {
@include reset-display;
@include reset-layout-direction;
}
13 changes: 13 additions & 0 deletions app/assets/stylesheets/settings/_disable-warnings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Disable all deprecation warnings. Defaults to `false`. Set with a `!global` flag.
*
* @type Bool
*/

$disable-warnings: false !default;

@mixin -neat-warn($message) {
@if $disable-warnings == false {
@warn "#{$message}";
}
}
1 change: 1 addition & 0 deletions test/_setup.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import 'bourbon/bourbon';
@import 'app/assets/stylesheets/neat';
$disable-warnings: true !global;

0 comments on commit 5c337cc

Please sign in to comment.