neat 1.9.1 → 2.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -4
  3. data/.hound.yml +5 -0
  4. data/.npmignore +0 -4
  5. data/.scss-lint.yml +3 -1
  6. data/CHANGELOG.md +45 -23
  7. data/CONTRIBUTING.md +12 -0
  8. data/Gemfile +1 -2
  9. data/Gulpfile.js +5 -6
  10. data/LICENSE.md +1 -1
  11. data/README.md +26 -163
  12. data/RELEASING.md +27 -0
  13. data/Rakefile +3 -13
  14. data/bower.json +8 -9
  15. data/circle.yml +13 -0
  16. data/contrib/base/_grids.scss +4 -0
  17. data/contrib/base/_variables.scss +8 -0
  18. data/contrib/index.html +68 -223
  19. data/contrib/patterns/_box.scss +11 -0
  20. data/contrib/patterns/_global.scss +5 -0
  21. data/contrib/patterns/_grid-media.scss +52 -0
  22. data/contrib/patterns/_grid-nested.scss +7 -0
  23. data/contrib/patterns/_grid-push.scss +7 -0
  24. data/contrib/patterns/_grid-shift.scss +7 -0
  25. data/contrib/patterns/_grid.scss +31 -0
  26. data/contrib/styles.scss +12 -293
  27. data/core/_neat.scss +20 -0
  28. data/core/neat/functions/_neat-column-default.scss +23 -0
  29. data/core/neat/functions/_neat-column-ratio.scss +24 -0
  30. data/core/neat/functions/_neat-column-width.scss +25 -0
  31. data/core/neat/functions/_neat-parse-columns.scss +22 -0
  32. data/core/neat/functions/_neat-parse-media.scss +20 -0
  33. data/core/neat/functions/_retrieve-neat-settings.scss +18 -0
  34. data/core/neat/mixins/_grid-column.scss +29 -0
  35. data/{app/assets/stylesheets/mixins/_clearfix.scss → core/neat/mixins/_grid-container.scss} +5 -5
  36. data/core/neat/mixins/_grid-media.scss +50 -0
  37. data/core/neat/mixins/_grid-push.scss +32 -0
  38. data/core/neat/mixins/_grid-shift.scss +31 -0
  39. data/core/neat/settings/_settings.scss +41 -0
  40. data/index.js +1 -1
  41. data/lib/neat.rb +5 -18
  42. data/lib/neat/generator.rb +1 -1
  43. data/lib/neat/version.rb +1 -1
  44. data/neat.gemspec +27 -33
  45. data/package.json +5 -4
  46. data/spec/.keep +0 -0
  47. data/spec/fixtures/_setup.scss +1 -0
  48. data/spec/fixtures/functions/neat-column-default.scss +22 -0
  49. data/spec/fixtures/functions/neat-column-width.scss +30 -0
  50. data/spec/fixtures/functions/neat-parse-media.scss +9 -0
  51. data/spec/fixtures/functions/retrieve-neat-settings.scss +22 -0
  52. data/spec/fixtures/mixins/grid-column.scss +57 -0
  53. data/spec/fixtures/mixins/grid-container.scss +5 -0
  54. data/spec/fixtures/mixins/grid-push.scss +38 -0
  55. data/spec/fixtures/mixins/grid-shift.scss +38 -0
  56. data/spec/neat/functions/neat_column_default_spec.rb +35 -0
  57. data/spec/neat/functions/neat_column_width_spec.rb +47 -0
  58. data/spec/neat/functions/neat_parse_media_spec.rb +23 -0
  59. data/spec/neat/functions/retrieve_neat_settings_spec.rb +35 -0
  60. data/spec/neat/mixins/grid_column_spec.rb +101 -0
  61. data/spec/neat/mixins/grid_container_spec.rb +17 -0
  62. data/spec/neat/mixins/grid_push_spec.rb +59 -0
  63. data/spec/neat/mixins/grid_shift_spec.rb +59 -0
  64. data/spec/support/matchers/have_ruleset.rb +20 -0
  65. data/spec/support/matchers/have_value.rb +9 -7
  66. data/spec/support/parser_support.rb +8 -1
  67. data/spec/support/sass_support.rb +1 -1
  68. metadata +76 -153
  69. data/.rspec +0 -1
  70. data/.ruby-version +0 -1
  71. data/.travis.yml +0 -10
  72. data/app/assets/stylesheets/_neat-helpers.scss +0 -11
  73. data/app/assets/stylesheets/_neat.scss +0 -24
  74. data/app/assets/stylesheets/functions/_new-breakpoint.scss +0 -49
  75. data/app/assets/stylesheets/functions/_private.scss +0 -154
  76. data/app/assets/stylesheets/grid/_box-sizing.scss +0 -15
  77. data/app/assets/stylesheets/grid/_direction-context.scss +0 -33
  78. data/app/assets/stylesheets/grid/_display-context.scss +0 -28
  79. data/app/assets/stylesheets/grid/_fill-parent.scss +0 -22
  80. data/app/assets/stylesheets/grid/_media.scss +0 -92
  81. data/app/assets/stylesheets/grid/_omega.scss +0 -112
  82. data/app/assets/stylesheets/grid/_outer-container.scss +0 -34
  83. data/app/assets/stylesheets/grid/_pad.scss +0 -25
  84. data/app/assets/stylesheets/grid/_private.scss +0 -35
  85. data/app/assets/stylesheets/grid/_reset-display.scss +0 -14
  86. data/app/assets/stylesheets/grid/_row.scss +0 -45
  87. data/app/assets/stylesheets/grid/_shift.scss +0 -50
  88. data/app/assets/stylesheets/grid/_span-columns.scss +0 -94
  89. data/app/assets/stylesheets/grid/_to-deprecate.scss +0 -81
  90. data/app/assets/stylesheets/grid/_visual-grid.scss +0 -42
  91. data/app/assets/stylesheets/settings/_disable-warnings.scss +0 -13
  92. data/app/assets/stylesheets/settings/_grid.scss +0 -51
  93. data/app/assets/stylesheets/settings/_visual-grid.scss +0 -27
  94. data/lib/neat/engine.rb +0 -5
  95. data/lib/tasks/install.rake +0 -19
  96. data/sache.json +0 -5
  97. data/spec/neat/columns_spec.rb +0 -73
  98. data/spec/neat/container_spec.rb +0 -21
  99. data/spec/neat/default_spec.rb +0 -15
  100. data/spec/neat/direction_spec.rb +0 -19
  101. data/spec/neat/display_spec.rb +0 -19
  102. data/spec/neat/media_spec.rb +0 -55
  103. data/spec/neat/new_breakpoint_spec.rb +0 -17
  104. data/spec/neat/omega_spec.rb +0 -66
  105. data/spec/neat/pad_spec.rb +0 -32
  106. data/spec/neat/row_spec.rb +0 -39
  107. data/spec/neat/shift_spec.rb +0 -41
  108. data/test/_setup.scss +0 -2
  109. data/test/default.scss +0 -1
  110. data/test/direction-context.scss +0 -13
  111. data/test/display-context.scss +0 -15
  112. data/test/media.scss +0 -39
  113. data/test/new-breakpoint.scss +0 -13
  114. data/test/omega.scss +0 -29
  115. data/test/outer-container.scss +0 -11
  116. data/test/pad.scss +0 -17
  117. data/test/row.scss +0 -26
  118. data/test/shift.scss +0 -36
  119. data/test/span-columns.scss +0 -21
@@ -0,0 +1,22 @@
1
+ @charset "UTF-8";
2
+ /// Parse a column count like `3 of 5` and retur the total coloumn count.
3
+ /// This is to allow a shorthand for custom grids without using a settings map.
4
+ ///
5
+ ///
6
+ /// @argument {list} $span
7
+ ///
8
+ /// @return {number}
9
+ ///
10
+ /// @example scss
11
+ /// _neat-parse-columns(3 of 5)
12
+ ///
13
+ /// @access private
14
+
15
+ @function _neat-parse-columns($span) {
16
+ @if length($span) == 3 {
17
+ $_total-columns: nth($span, 3);
18
+ @return $_total-columns;
19
+ } @else if length($span) == 2 or if length($span) >= 3 {
20
+ @error "`$column` should contain 2 values, seperated by an `of`";
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ @charset "UTF-8";
2
+ /// Parse media types. If the property is a string then return it, otherwise
3
+ /// assume screen and min-width.
4
+ ///
5
+ /// @argument {string | number (with unit)} $media
6
+ ///
7
+ /// @return {number}
8
+ ///
9
+ /// @example scss
10
+ /// _neat-parse-media($grid, 1000px)
11
+ ///
12
+ /// @access private
13
+
14
+ @function _neat-parse-media($media) {
15
+ @if type-of($media) == number {
16
+ @return "only screen and (min-width: #{$media})";
17
+ } @else if type-of($media) == string {
18
+ @return "#{$media}";
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ @charset "UTF-8";
2
+ /// Return a Neat setting.
3
+ ///
4
+ /// @argument {map} $grid
5
+ ///
6
+ /// @argument {string} $setting
7
+ ///
8
+ /// @return {boolean | color | list | number | string}
9
+ ///
10
+ /// @example scss
11
+ /// _retrieve-neat-setting($neat-grid, columns)
12
+ ///
13
+ /// @access private
14
+
15
+ @function _retrieve-neat-setting($grid, $setting) {
16
+ $_grid-settings: map-merge($_neat-grid-defaults, $grid);
17
+ @return map-get($_grid-settings, $setting);
18
+ }
@@ -0,0 +1,29 @@
1
+ @charset "UTF-8";
2
+ /// Creates Neat a grid column of requested size.
3
+ ///
4
+ /// @argument {number (unitless)} $columns [null]
5
+ ///
6
+ /// @argument {map} $grid [$neat-grid]
7
+ /// The grid used to generate the column.
8
+ ///
9
+ /// @example scss
10
+ /// .element {
11
+ /// @include grid-column(3);
12
+ /// }
13
+ ///
14
+ /// @example css
15
+ /// .element {
16
+ /// width: calc(25% - 25px);
17
+ /// float: left;
18
+ /// margin-left: 20px;
19
+ /// }
20
+
21
+ @mixin grid-column($columns: null, $grid: $neat-grid) {
22
+ $columns: _neat-column-default($grid, $columns);
23
+ $_grid-columns: _retrieve-neat-setting($grid, columns);
24
+ $_grid-gutter: _retrieve-neat-setting($grid, gutter);
25
+
26
+ width: calc(#{_neat-column-width($grid, $columns)});
27
+ float: left;
28
+ margin-left: $_grid-gutter;
29
+ }
@@ -1,12 +1,12 @@
1
1
  @charset "UTF-8";
2
-
3
- /// Provides an easy way to include a clearfix for containing floats.
2
+ /// Creates a Neat grid container with clearfix.
4
3
  ///
5
- /// @link http://goo.gl/yP5hiZ
4
+ /// @argument {map} $grid [$neat-grid]
5
+ /// The type of grid for this column.
6
6
  ///
7
7
  /// @example scss
8
8
  /// .element {
9
- /// @include clearfix;
9
+ /// @include grid-container;
10
10
  /// }
11
11
  ///
12
12
  /// @example css
@@ -16,7 +16,7 @@
16
16
  /// display: block;
17
17
  /// }
18
18
 
19
- @mixin clearfix {
19
+ @mixin grid-container($grid: $neat-grid) {
20
20
  &::after {
21
21
  clear: both;
22
22
  content: "";
@@ -0,0 +1,50 @@
1
+ @charset "UTF-8";
2
+ /// Creates a media query in which custom grid properties can be defined.
3
+ /// Add the `media` property to your custom grid settings map and add the media
4
+ /// you would like to scope to. If only a number is defined, it is assumed this
5
+ /// is a `min-with` value. Your custom grid can then be passed to the mixin.
6
+ ///
7
+ /// @argument {map} $grid
8
+ /// The grid used to generate the column.
9
+ ///
10
+ /// @example scss
11
+ /// $custom-neat-grid: (
12
+ /// columns: 12,
13
+ /// gutter: 50px,
14
+ /// media: 1000px,
15
+ /// );
16
+ ///
17
+ /// .element {
18
+ /// @include grid-column(3);
19
+ ///
20
+ /// @include grid-media($custom-neat-grid){
21
+ /// @include grid-column(6);
22
+ /// }
23
+ /// }
24
+ ///
25
+ /// @example css
26
+ /// .element {
27
+ /// width: calc(25% - 25px);
28
+ /// float: left;
29
+ /// margin-left: 20px;
30
+ /// }
31
+ ///
32
+ /// @media only screen and (min-width: 1000px) {
33
+ /// .element {
34
+ /// width: calc(50% - 75px);
35
+ /// float: left;
36
+ /// margin-left: 50px;
37
+ /// }
38
+ /// }
39
+
40
+ @mixin grid-media($grid) {
41
+ $_media: _retrieve-neat-setting($grid, media);
42
+ $_query: _neat-parse-media($_media);
43
+
44
+ @media #{$_query} {
45
+ $_default-neat-grid: $neat-grid;
46
+ $neat-grid: $grid !global;
47
+ @content;
48
+ $neat-grid: $_default-neat-grid !global;
49
+ }
50
+ }
@@ -0,0 +1,32 @@
1
+ @charset "UTF-8";
2
+ /// Push or pull a Neat grid column by manipulating its left margin.
3
+ ///
4
+ /// @argument {number (unitless)} $push [false]
5
+ ///
6
+ /// @argument {map} $grid [$neat-grid]
7
+ /// The grid to be used to generate the column.
8
+ /// By default, the global `$neat-grid` will be used.
9
+ ///
10
+ /// @example scss
11
+ /// .element {
12
+ /// @include grid-push(3);
13
+ /// }
14
+ ///
15
+ /// @example css
16
+ /// .element {
17
+ /// margin-left: calc(25% - 25px + 40px);
18
+ /// }
19
+
20
+ @mixin grid-push($push: false, $grid: $neat-grid) {
21
+ $_grid-columns: _retrieve-neat-setting($grid, columns);
22
+ $_grid-gutter: _retrieve-neat-setting($grid, gutter);
23
+
24
+ @if $push {
25
+ $_gutter-affordance: $_grid-gutter * 2;
26
+ $_margin-value: calc(#{_neat-column-width($grid, $push)} + #{$_gutter-affordance});
27
+ margin-left: $_margin-value;
28
+ } @else {
29
+ $_margin-value: _retrieve-neat-setting($grid, gutter);
30
+ margin-left: $_margin-value;
31
+ }
32
+ }
@@ -0,0 +1,31 @@
1
+ @charset "UTF-8";
2
+ /// Shift columns and reorder them within their container using relative
3
+ /// positioning.
4
+ ///
5
+ /// @argument {number (unitless)} $shift [false]
6
+ ///
7
+ /// @argument {map} $grid [$neat-grid]
8
+ /// The grid to be used to generate the column.
9
+ /// By default, the global `$neat-grid` will be used.
10
+ ///
11
+ /// @example scss
12
+ /// .element {
13
+ /// @include grid-shift(3);
14
+ /// }
15
+ ///
16
+ /// @example css
17
+ /// .element {
18
+ /// left: calc(25% - 25px + 20px);
19
+ /// position: relative;
20
+ /// }
21
+
22
+ @mixin grid-shift($shift: false, $grid: $neat-grid) {
23
+ @if $shift {
24
+ $_shift-value: calc(#{_neat-column-width($grid, $shift)} + #{_retrieve-neat-setting($grid, gutter)});
25
+ left: $_shift-value;
26
+ } @else {
27
+ left: auto;
28
+ }
29
+
30
+ position: relative;
31
+ }
@@ -0,0 +1,41 @@
1
+ @charset "UTF-8";
2
+ /// Neat’s default grid.
3
+ ///
4
+ /// @type map
5
+ ///
6
+ /// @property {number (unitless)} columns [12]
7
+ /// Deefault number of grid columns.
8
+ ///
9
+ /// @property {number (with unit)} gutter [20px]
10
+ /// Default grid gutter width.
11
+ ///
12
+ /// @property {string | number (with unit)} gutter [null]
13
+ /// Grid media query.
14
+ ///
15
+ /// @access private
16
+
17
+ $_neat-grid-defaults: (
18
+ columns: 12,
19
+ gutter: 20px,
20
+ media: null,
21
+ );
22
+
23
+ /// This variable is a sass map that overrides Neat's default grid settings.
24
+ /// Use this to define your project's grid properties incluting gutters, and
25
+ /// total column count.
26
+ ///
27
+ /// @type map
28
+ ///
29
+ /// @property {number (unitless)} columns [12]
30
+ /// Number of grid columns.
31
+ ///
32
+ /// @property {number (with unit)} gutter [20px]
33
+ /// Grid gutter width.
34
+ ///
35
+ /// @example scss
36
+ /// $neat-grid: (
37
+ /// columns: 12,
38
+ /// gutter: 20px,
39
+ /// );
40
+
41
+ $neat-grid: () !default;
data/index.js CHANGED
@@ -2,6 +2,6 @@ var path = require("path");
2
2
 
3
3
  module.exports = {
4
4
  includePaths: [
5
- path.join(__dirname, "app/assets/stylesheets"),
5
+ path.join(__dirname, "core")
6
6
  ]
7
7
  };
@@ -1,20 +1,7 @@
1
- require "sass"
2
1
  require "neat/generator"
3
2
 
4
- module Neat
5
- if defined?(Rails) && defined?(Rails::Engine)
6
- class Engine < ::Rails::Engine
7
- require 'neat/engine'
8
- end
9
-
10
- module Rails
11
- class Railtie < ::Rails::Railtie
12
- rake_tasks do
13
- load "tasks/install.rake"
14
- end
15
- end
16
- end
17
- else
18
- Sass.load_paths << File.expand_path("../../app/assets/stylesheets", __FILE__)
19
- end
20
- end
3
+ neat_path = File.expand_path("../../core", __FILE__)
4
+ ENV["SASS_PATH"] = [
5
+ ENV["SASS_PATH"],
6
+ neat_path,
7
+ ].compact.join(File::PATH_SEPARATOR)
@@ -27,7 +27,7 @@ module Neat
27
27
  end
28
28
  end
29
29
 
30
- desc "remove", "Remove Neat"
30
+ desc "update", "Remove Neat"
31
31
  def remove
32
32
  if neat_files_already_exist?
33
33
  remove_neat_directory
@@ -1,3 +1,3 @@
1
1
  module Neat
2
- VERSION = "1.9.1".freeze
2
+ VERSION = "2.0.0.alpha.1"
3
3
  end
@@ -1,37 +1,31 @@
1
- # coding: utf-8
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'neat/version'
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "neat/version"
4
3
 
5
4
  Gem::Specification.new do |s|
6
- s.name = 'neat'
7
- s.version = Neat::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Joel Oliveira', 'Kyle Fiedler', 'Reda Lemeden']
10
- s.email = 'design+bourbon@thoughtbot.com'
11
- s.homepage = 'http://neat.bourbon.io'
12
- s.summary = 'A lightweight, semantic grid framework'
13
- s.license = 'MIT'
14
- s.description = <<-DESC
15
- Neat is a fluid grid framework built with the aim of being easy enough to use
16
- out of the box and flexible enough to customize down the road.
17
- DESC
18
-
19
- s.rubyforge_project = 'neat'
20
-
21
- s.files = `git ls-files`.split("\n")
22
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
5
+ s.add_development_dependency "aruba", "~> 0.5.0"
6
+ s.add_development_dependency "css_parser"
7
+ s.add_development_dependency "rake"
8
+ s.add_development_dependency "rspec"
9
+ s.add_development_dependency "scss_lint", "~> 0.44"
10
+ s.add_runtime_dependency "sass", "~> 3.4"
11
+ s.add_runtime_dependency "thor", "~> 0.19"
12
+ s.authors = [
13
+ "Joel Oliveira",
14
+ "Joshua Ogle",
15
+ "Kyle Fiedler",
16
+ "Reda Lemeden",
17
+ "Tyson Gach",
18
+ "Ward Penney",
19
+ "Will McMahan"
20
+ ]
21
+ s.email = "design+neat@thoughtbot.com"
23
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
- s.require_paths = ['lib']
25
-
26
- s.add_dependency('sass', '>= 3.3')
27
- s.add_dependency("thor", "~> 0.19")
28
-
29
- s.add_development_dependency("scss_lint", "~> 0.43")
30
- s.add_development_dependency('aruba', '~> 0.5.0')
31
- s.add_development_dependency('bundler')
32
- s.add_development_dependency('css_parser')
33
- s.add_development_dependency('rake')
34
- s.add_development_dependency('rb-fsevent', '~> 0.9.1')
35
- s.add_development_dependency('rdoc')
36
- s.add_development_dependency('rspec')
23
+ s.files = `git ls-files`.split("\n")
24
+ s.homepage = "http://neat.bourbon.io"
25
+ s.license = "MIT"
26
+ s.name = "neat"
27
+ s.platform = Gem::Platform::RUBY
28
+ s.require_paths = ["lib"]
29
+ s.summary = "A lightweight Sass grid framework"
30
+ s.version = Neat::VERSION
37
31
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bourbon-neat",
3
- "version": "1.9.1",
4
- "description": "A lightweight, semantic grid framework",
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "A lightweight, semantic grid framework built with Bourbon",
5
5
  "keywords": [
6
6
  "columns",
7
7
  "grid",
@@ -30,10 +30,11 @@
30
30
  "url": "https://github.com/thoughtbot/neat.git"
31
31
  },
32
32
  "scripts": {
33
- "test": "echo \"No test specified\""
33
+ "contrib": "gulp",
34
+ "test": "bundle exec rake"
34
35
  },
35
36
  "dependencies": {
36
- "node-sass": "^4.1.1"
37
+ "node-sass": "^3.8"
37
38
  },
38
39
  "devDependencies": {
39
40
  "gulp": "^3.9",
File without changes
@@ -0,0 +1 @@
1
+ @import "core/neat";
@@ -0,0 +1,22 @@
1
+ @import "setup";
2
+
3
+ $eighteen-grid: (
4
+ columns: 18,
5
+ gutter: 33px,
6
+ );
7
+
8
+ .neat-column-default-grid {
9
+ content: _neat-column-default($neat-grid, null);
10
+ }
11
+
12
+ .neat-column-default-grid-custom-col {
13
+ content: _neat-column-default($neat-grid, 10);
14
+ }
15
+
16
+ .neat-column-custom-grid {
17
+ content: _neat-column-default($eighteen-grid, null);
18
+ }
19
+
20
+ .neat-column-custom-grid-custom-col {
21
+ content: _neat-column-default($eighteen-grid, 10);
22
+ }