Skip to content

Commit

Permalink
Remove Bourbon as a dependency
Browse files Browse the repository at this point in the history
(feelsbadman) but the dependency on Bourbon was technically minimal. By
removing the dependency on Bourbon we are able to gain more users and
can potentially grow the community.

resolves thoughtbot#346
  • Loading branch information
Curt Howard committed Jun 3, 2016
1 parent 4bef318 commit 19bc2dc
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 75 deletions.
5 changes: 2 additions & 3 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var bourbon = require("bourbon").includePaths,
autoprefix = require("gulp-autoprefixer"),
var autoprefix = require("gulp-autoprefixer"),
connect = require("gulp-connect"),
gulp = require("gulp"),
sass = require("gulp-sass");
Expand All @@ -13,7 +12,7 @@ var paths = {
gulp.task("sass", function () {
return gulp.src(paths.scss)
.pipe(sass({
includePaths: ["styles"].concat(bourbon)
sourcemaps: true
}))
.pipe(autoprefix("last 2 versions"))
.pipe(gulp.dest("./contrib"))
Expand Down
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![Gitter](http://img.shields.io/badge/gitter-neat-ae3dd2.svg?style=flat)](https://gitter.im/thoughtbot/neat)
[![Stack Overflow](http://img.shields.io/badge/stack%20overflow-neat-ae3dd2.svg?style=flat)](http://stackoverflow.com/questions/tagged/neat)

## A lightweight, semantic grid framework built with Bourbon
## A lightweight, semantic grid framework

Neat is a fluid grid framework built with [Bourbon](https://github.com/thoughtbot/bourbon) with the aim of being easy enough to use out of the box and flexible enough to customize down the road.
Neat is a fluid grid framework with the aim of being easy enough to use out of the box and flexible enough to customize down the road.

- **[Demo](http://neat.bourbon.io)**
- **[Documentation](http://thoughtbot.github.io/neat-docs/latest)**
Expand All @@ -19,7 +19,6 @@ for updates.
## Requirements

- [Sass](https://github.com/sass/sass) 3.3+
- [Bourbon](https://github.com/thoughtbot/bourbon) 4.0+
- :warning: If you need **Sass 3.2 support**, you should [use Neat 1.5.1](#installing-older-versions-of-neat)

## Installation
Expand All @@ -39,23 +38,16 @@ For command line help, visit our wiki page on Neat’s [command line interface](
```bash
gem install sass # or gem update sass
```
```bash
gem install bourbon # or gem update bourbon
```

3. Install the Neat library into the current directory:

```bash
bourbon install # if not already installed
```
```bash
neat install
```

4. Import Neat in your stylesheet, after Bourbon:
4. Import Neat in your stylesheet:

```scss
@import "bourbon/bourbon";
@import "neat/neat";
```

Expand All @@ -81,10 +73,9 @@ For command line help, visit our wiki page on Neat’s [command line interface](
bundle update sass
```

3. Import Neat in your `application.scss`, after Bourbon:
3. Import Neat in your `application.scss`:

```scss
@import "bourbon";
@import "neat";
```

Expand All @@ -98,12 +89,11 @@ For command line help, visit our wiki page on Neat’s [command line interface](
npm install --save bourbon-neat
```

1. If you’re using [Eyeglass](http://eyeglass.rocks), skip to Step 3. Otherwise, you’ll need to add Bourbon and Neat to your node-sass `includePaths` option. `require("bourbon-neat").includePaths` is an array of directories that you should pass to node-sass. How you do this depends on how node-sass is integrated into your project. You will also need to ensure that Bourbon is in the `includePaths` passed to node-sass.
1. If you’re using [Eyeglass](http://eyeglass.rocks), skip to Step 3. Otherwise, you’ll need to add Neat to your node-sass `includePaths` option. How you do this depends on how node-sass is integrated into your project.

1. Import Neat into your Sass files, after Bourbon:
1. Import Neat into your Sass files:

```scss
@import "bourbon";
@import "neat";
```

Expand All @@ -128,15 +118,13 @@ For command line help, visit our wiki page on Neat’s [command line interface](
First off, if you are planning to override the default grid settings (12 columns), it is recommended to create a `_grid-settings.scss` file for that purpose. Make sure to import it right *before* importing Neat:

```scss
@import "bourbon/bourbon"; // or "bourbon" when in Rails
@import "grid-settings";
@import "neat/neat"; // or "neat" when in Rails
```

In your newly created `_grid-settings.scss`, import `neat-helpers` if you are planning to use `new-breakpoint()`, then define your new variables:
```scss
@import "bourbon/bourbon"; // or "bourbon" when in Rails
@import "neat/neat-helpers"; // or "neat-helpers" when in Rails

// Change the grid settings
Expand Down
4 changes: 0 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ RSpec::Core::RakeTask.new(:spec)
task :default => :spec

task :test do
puts "Creating a Bourbon directory..."
`bourbon install --path test`
puts "Generating CSS..."
`sass -I . --watch test:css/ --style expanded`
end

task :clean do
puts "Deleting Bourbon directory..."
`rm -rf test/bourbon`
puts "Deleting generated CSS..."
`rm -rf css/`
end
3 changes: 3 additions & 0 deletions app/assets/stylesheets/_neat-helpers.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Mixins
@import "mixins/clearfix";

// Functions
@import "functions/private";
@import "functions/new-breakpoint";
Expand Down
25 changes: 25 additions & 0 deletions app/assets/stylesheets/mixins/_clearfix.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@charset "UTF-8";

/// Provides an easy way to include a clearfix for containing floats.
///
/// @link http://goo.gl/yP5hiZ
///
/// @example scss
/// .element {
/// @include clearfix;
/// }
///
/// @example css
/// .element::after {
/// clear: both;
/// content: "";
/// display: block;
/// }
@mixin clearfix {
&::after {
clear: both;
content: "";
display: block;
}
}
8 changes: 4 additions & 4 deletions app/assets/stylesheets/settings/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@charset "UTF-8";

/// Sets the relative width of a single grid column. The unit used should be the same one used to define `$gutter`. To learn more about `modular-scale()` see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with a `!global` flag.
/// Sets the relative width of a single grid column. The unit used should be the same one used to define `$gutter`. Set with a `!global` flag.
///
/// @type Number (Unit)

$column: modular-scale(3, 1em, $golden) !default;
$column: 4.2358em !default;

/// Sets the relative width of a single grid gutter. The unit used should be the same one used to define `$column`. To learn more about `modular-scale()` see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with the `!global` flag.
/// Sets the relative width of a single grid gutter. The unit used should be the same one used to define `$column`. Set with the `!global` flag.
///
/// @type Number (Unit)

$gutter: modular-scale(1, 1em, $golden) !default;
$gutter: 1.618em !default;

/// Sets the total number of columns in the grid. Its value can be overridden inside a media query using the `media()` mixin. Set with the `!global` flag.
///
Expand Down
6 changes: 1 addition & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neat",
"description": "A lightweight, semantic grid framework built with Bourbon",
"description": "A lightweight, semantic grid framework",
"version": "1.7.4",
"main": "app/assets/stylesheets/_neat.scss",
"license": "MIT",
Expand All @@ -19,7 +19,6 @@
"test"
],
"keywords": [
"bourbon",
"columns",
"grid",
"layout",
Expand All @@ -38,8 +37,5 @@
"repository": {
"type": "git",
"url": "https://github.com/thoughtbot/neat.git"
},
"dependencies": {
"bourbon": ">=4.0"
}
}
9 changes: 4 additions & 5 deletions contrib/styles.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "bourbon";
@import "../app/assets/stylesheets/neat";

// Grid Settings
Expand Down Expand Up @@ -35,7 +34,7 @@ $darkerblue: #072f44;

body {
color: $darkerblue;
font-family: $helvetica;
font-family: sans-serif;
line-height: $base-line-height;
margin: 0 0 (1.5rem * 2);
text-align: center;
Expand All @@ -62,17 +61,17 @@ code {
// ============================================

.container {
@include margin(null auto);
@include padding(null $gutter);
margin: 0 auto;
max-width: 500px;
padding: 0 $gutter;
position: relative;
}

.welcome-message {
@include clearfix();
@include padding($base-spacing null);
background-color: $blue;
margin-bottom: 1.5rem;
padding: $base-spacing 0;
text-align: center;
}

Expand Down
1 change: 0 additions & 1 deletion lib/neat.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "sass"
require "bourbon"
require "neat/generator"

module Neat
Expand Down
24 changes: 11 additions & 13 deletions lib/tasks/install.rake
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
require "fileutils"
require "find"

namespace :bourbon do
namespace :neat do
desc "Copy Neat's files to the Rails assets directory."
task :install, [:sass_path] do |t, args|
args.with_defaults(:sass_path => 'public/stylesheets/sass')
source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
FileUtils.mkdir_p("#{Rails.root}/#{args.sass_path}/neat")
FileUtils.cp_r("#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/neat", { :preserve => true })
namespace :neat do
desc "Copy Neat's files to the Rails assets directory."
task :install, [:sass_path] do |t, args|
args.with_defaults(:sass_path => 'public/stylesheets/sass')
source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
FileUtils.mkdir_p("#{Rails.root}/#{args.sass_path}/neat")
FileUtils.cp_r("#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/neat", { :preserve => true })

Find.find("#{Rails.root}/#{args.sass_path}/neat") do |path|
if path.end_with?(".css.scss")
path_without_css_extension = path.gsub(/\.css\.scss$/, ".scss")
FileUtils.mv(path, path_without_css_extension)
end
Find.find("#{Rails.root}/#{args.sass_path}/neat") do |path|
if path.end_with?(".css.scss")
path_without_css_extension = path.gsub(/\.css\.scss$/, ".scss")
FileUtils.mv(path, path_without_css_extension)
end
end
end
Expand Down
7 changes: 3 additions & 4 deletions neat.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Gem::Specification.new do |s|
s.authors = ['Joel Oliveira', 'Kyle Fiedler', 'Reda Lemeden']
s.email = 'design+bourbon@thoughtbot.com'
s.homepage = 'http://neat.bourbon.io'
s.summary = 'A lightweight, semantic grid framework built with Bourbon'
s.summary = 'A lightweight, semantic grid framework'
s.license = 'MIT'
s.description = <<-DESC
Neat is a fluid grid framework built with Bourbon with the aim of being easy
enough to use out of the box and flexible enough to customize down the road.
Neat is a fluid grid framework built with the aim of being easy enough to use
out of the box and flexible enough to customize down the road.
DESC

s.rubyforge_project = 'neat'
Expand All @@ -23,7 +23,6 @@ enough to use out of the box and flexible enough to customize down the road.
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ['lib']

s.add_dependency('bourbon', '>= 4.0')
s.add_dependency('sass', '>= 3.3')
s.add_dependency("thor", "~> 0.19")

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "bourbon-neat",
"version": "1.7.4",
"description": "A lightweight, semantic grid framework built with Bourbon",
"description": "A lightweight, semantic grid framework",
"keywords": [
"bourbon",
"columns",
"grid",
"layout",
Expand Down Expand Up @@ -34,7 +33,6 @@
"test": "echo \"No test specified\""
},
"dependencies": {
"bourbon": "^4.2",
"node-sass": "^3.4"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions sache.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Neat",
"description": "A lightweight, semantic grid framework built with Bourbon",
"tags": ["bourbon", "columns", "grid", "layout", "media", "media-queries", "neat", "queries", "sass", "scss", "semantic"]
"description": "A lightweight, semantic grid framework",
"tags": ["columns", "grid", "layout", "media", "media-queries", "neat", "queries", "sass", "scss", "semantic"]
}
3 changes: 0 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
config.include BourbonSupport
config.include SassSupport
config.include CssParser
config.include ParserSupport
config.include Aruba::Api

config.before(:all) do
install_bourbon_files
generate_css
end

config.after(:all) do
remove_bourbon_files
clean_up
end
end
9 changes: 0 additions & 9 deletions spec/support/bourbon_support.rb

This file was deleted.

1 change: 0 additions & 1 deletion test/_setup.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import "bourbon/bourbon";
@import "../app/assets/stylesheets/neat";
$disable-warnings: true !global;

0 comments on commit 19bc2dc

Please sign in to comment.