Git Product home page Git Product logo

bootstrap-sass's Introduction

Bootstrap 3 for Sass

Gem Version npm version Bower Version Build Status

bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.

This is Bootstrap 3. For Bootstrap 4 use the Bootstrap rubygem if you use Ruby, and the main repo otherwise.

Installation

Please see the appropriate guide for your environment of choice:

a. Ruby on Rails

bootstrap-sass is easy to drop into Rails with the asset pipeline.

In your Gemfile you need to add the bootstrap-sass gem, and ensure that the sass-rails gem is present - it is added to new Rails applications by default.

gem 'bootstrap-sass', '~> 3.4.1'
gem 'sassc-rails', '>= 2.1.0'

bundle install and restart your server to make the files available through the pipeline.

Import Bootstrap styles in app/assets/stylesheets/application.scss:

// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
@import "bootstrap-sprockets";
@import "bootstrap";

bootstrap-sprockets must be imported before bootstrap for the icon fonts to work.

Make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it:

$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss

Then, remove all the *= require_self and *= require_tree . statements from the sass file. Instead, use @import to import Sass files.

Do not use *= require in Sass or your other stylesheets will not be able to access the Bootstrap mixins or variables.

Bootstrap JavaScript depends on jQuery. If you're using Rails 5.1+, add the jquery-rails gem to your Gemfile:

gem 'jquery-rails'
$ bundle install

Require Bootstrap Javascripts in app/assets/javascripts/application.js:

//= require jquery
//= require bootstrap-sprockets

bootstrap-sprockets and bootstrap should not both be included in application.js.

bootstrap-sprockets provides individual Bootstrap Javascript files (alert.js or dropdown.js, for example), while bootstrap provides a concatenated file containing all Bootstrap Javascripts.

Bower with Rails

When using bootstrap-sass Bower package instead of the gem in Rails, configure assets in config/application.rb:

# Bower asset paths
root.join('vendor', 'assets', 'bower_components').to_s.tap do |bower_path|
  config.sass.load_paths << bower_path
  config.assets.paths << bower_path
end
# Precompile Bootstrap fonts
config.assets.precompile << %r(bootstrap-sass/assets/fonts/bootstrap/[\w-]+\.(?:eot|svg|ttf|woff2?)$)
# Minimum Sass number precision required by bootstrap-sass
::Sass::Script::Value::Number.precision = [8, ::Sass::Script::Value::Number.precision].max

Replace Bootstrap @import statements in application.scss with:

$icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/";
@import "bootstrap-sass/assets/stylesheets/bootstrap-sprockets";
@import "bootstrap-sass/assets/stylesheets/bootstrap";

Replace Bootstrap require directive in application.js with:

//= require bootstrap-sass/assets/javascripts/bootstrap-sprockets

Rails 4.x

Please make sure sprockets-rails is at least v2.1.4.

Rails 3.2.x

bootstrap-sass is no longer compatible with Rails 3. The latest version of bootstrap-sass compatible with Rails 3.2 is v3.1.1.0.

b. Bower

bootstrap-sass Bower package is compatible with node-sass 3.2.0+. You can install it with:

$ bower install bootstrap-sass

Sass, JS, and all other assets are located at assets.

By default, bower.json main field list only the main _bootstrap.scss and all the static assets (fonts and JS). This is compatible by default with asset managers such as wiredep.

Node.js Mincer

If you use mincer with node-sass, import Bootstrap like so:

In application.css.ejs.scss (NB .css.ejs.scss):

// Import mincer asset paths helper integration
@import "bootstrap-mincer";
@import "bootstrap";

In application.js:

//= require bootstrap-sprockets

See also this example manifest.js for mincer.

c. npm / Node.js

$ npm install bootstrap-sass

Configuration

Sass

By default all of Bootstrap is imported.

You can also import components explicitly. To start with a full list of modules copy _bootstrap.scss file into your assets as _bootstrap-custom.scss. Then comment out components you do not want from _bootstrap-custom. In the application Sass file, replace @import 'bootstrap' with:

@import 'bootstrap-custom';

Sass: Number Precision

bootstrap-sass requires minimum Sass number precision of 8 (default is 5).

Precision is set for Ruby automatically when using the sassc-rails gem. When using the npm or Bower version with Ruby, you can set it with:

::Sass::Script::Value::Number.precision = [8, ::Sass::Script::Value::Number.precision].max

Sass: Autoprefixer

Bootstrap requires the use of Autoprefixer. Autoprefixer adds vendor prefixes to CSS rules using values from Can I Use.

To match upstream Bootstrap's level of browser compatibility, set Autoprefixer's browsers option to:

[
  "Android 2.3",
  "Android >= 4",
  "Chrome >= 20",
  "Firefox >= 24",
  "Explorer >= 8",
  "iOS >= 6",
  "Opera >= 12",
  "Safari >= 6"
]

JavaScript

assets/javascripts/bootstrap.js contains all of Bootstrap's JavaScript, concatenated in the correct order.

JavaScript with Sprockets or Mincer

If you use Sprockets or Mincer, you can require bootstrap-sprockets instead to load the individual modules:

// Load all Bootstrap JavaScript
//= require bootstrap-sprockets

You can also load individual modules, provided you also require any dependencies. You can check dependencies in the Bootstrap JS documentation.

//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/dropdown

Fonts

The fonts are referenced as:

"#{$icon-font-path}#{$icon-font-name}.eot"

$icon-font-path defaults to bootstrap/ if asset path helpers are used, and ../fonts/bootstrap/ otherwise.

When using bootstrap-sass with Compass, Sprockets, or Mincer, you must import the relevant path helpers before Bootstrap itself, for example:

@import "bootstrap-compass";
@import "bootstrap";

Usage

Sass

Import Bootstrap into a Sass file (for example, application.scss) to get all of Bootstrap's styles, mixins and variables!

@import "bootstrap";

You can also include optional Bootstrap theme:

@import "bootstrap/theme";

The full list of Bootstrap variables can be found here. You can override these by simply redefining the variable before the @import directive, e.g.:

$navbar-default-bg: #312312;
$light-orange: #ff8c00;
$navbar-default-color: $light-orange;

@import "bootstrap";

Eyeglass

Bootstrap is available as an Eyeglass module. After installing Bootstrap via NPM you can import the Bootstrap library via:

@import "bootstrap-sass/bootstrap"

or import only the parts of Bootstrap you need:

@import "bootstrap-sass/bootstrap/variables";
@import "bootstrap-sass/bootstrap/mixins";
@import "bootstrap-sass/bootstrap/carousel";

Version

Bootstrap for Sass version may differ from the upstream version in the last number, known as PATCH. The patch version may be ahead of the corresponding upstream minor. This happens when we need to release Sass-specific changes.

Before v3.3.2, Bootstrap for Sass version used to reflect the upstream version, with an additional number for Sass-specific changes. This was changed due to Bower and npm compatibility issues.

The upstream versions vs the Bootstrap for Sass versions are:

Upstream Sass
3.3.4+ same
3.3.2 3.3.3
<= 3.3.1 3.3.1.x

Always refer to CHANGELOG.md when upgrading.


Development and Contributing

If you'd like to help with the development of bootstrap-sass itself, read this section.

Upstream Converter

Keeping bootstrap-sass in sync with upstream changes from Bootstrap used to be an error prone and time consuming manual process. With Bootstrap 3 we have introduced a converter that automates this.

Note: if you're just looking to use Bootstrap 3, see the installation section above.

Upstream changes to the Bootstrap project can now be pulled in using the convert rake task.

Here's an example run that would pull down the master branch from the main twbs/bootstrap repo:

rake convert

This will convert the latest LESS to Sass and update to the latest JS. To convert a specific branch or version, pass the branch name or the commit hash as the first task argument:

rake convert[e8a1df5f060bf7e6631554648e0abde150aedbe4]

The latest converter script is located here and does the following:

  • Converts upstream Bootstrap LESS files to its matching SCSS file.
  • Copies all upstream JavaScript into assets/javascripts/bootstrap, a Sprockets manifest at assets/javascripts/bootstrap-sprockets.js, and a concatenation at assets/javascripts/bootstrap.js.
  • Copies all upstream font files into assets/fonts/bootstrap.
  • Sets Bootstrap::BOOTSTRAP_SHA in version.rb to the branch sha.

This converter fully converts original LESS to SCSS. Conversion is automatic but requires instructions for certain transformations (see converter output). Please submit GitHub issues tagged with conversion.

Credits

bootstrap-sass has a number of major contributors:

and a significant number of other contributors.

You're in good company

bootstrap-sass is used to build some awesome projects all over the web, including Diaspora, rails_admin, Michael Hartl's Rails Tutorial, gitlabhq and kandan.

bootstrap-sass's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap-sass's Issues

After Update Still Serving Bootstrap v 1.4.0

I updated my Gemfile and ran 'bundle update'. I cleared my browser cache just to be safe. And I restarted my app. For some reason I'm still seeing Bootstrap v 1.4.0 in my CSS files and not v 2.0. Any ideas?

Undefined mixin 'tab-focus'.

Attempting to define a CSS causing the the above error

Attaching the Stack Trace

bootstrap-sass (2.0.0) vendor/assets/stylesheets/bootstrap/_reset.scss:38:in tab-focus' bootstrap-sass (2.0.0) vendor/assets/stylesheets/bootstrap/_reset.scss:38 app/assets/stylesheets/application.css.scss:1 sass (3.1.14) lib/sass/tree/visitors/perform.rb:170:invisit_mixin'
sass (3.1.14) lib/sass/tree/visitors/base.rb:37:in visit' sass (3.1.14) lib/sass/tree/visitors/perform.rb:18:invisit'
sass (3.1.14) lib/sass/tree/visitors/base.rb:53:in block in visit_children' sass (3.1.14) lib/sass/tree/visitors/base.rb:53:inmap'
sass (3.1.14) lib/sass/tree/visitors/base.rb:53:in visit_children' sass (3.1.14) lib/sass/tree/visitors/perform.rb:27:inblock in visit_children'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:39:in with_environment' sass (3.1.14) lib/sass/tree/visitors/perform.rb:26:invisit_children'
sass (3.1.14) lib/sass/tree/visitors/base.rb:37:in block in visit' sass (3.1.14) lib/sass/tree/visitors/perform.rb:238:invisit_rule'
sass (3.1.14) lib/sass/tree/visitors/base.rb:37:in visit' sass (3.1.14) lib/sass/tree/visitors/perform.rb:18:invisit'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:146:in block in visit_import' sass (3.1.14) lib/sass/tree/visitors/perform.rb:146:inmap'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:146:in visit_import' sass (3.1.14) lib/sass/tree/visitors/base.rb:37:invisit'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:18:in visit' sass (3.1.14) lib/sass/tree/visitors/base.rb:53:inblock in visit_children'
sass (3.1.14) lib/sass/tree/visitors/base.rb:53:in map' sass (3.1.14) lib/sass/tree/visitors/base.rb:53:invisit_children'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:27:in block in visit_children' sass (3.1.14) lib/sass/tree/visitors/perform.rb:39:inwith_environment'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:26:in visit_children' sass (3.1.14) lib/sass/tree/visitors/base.rb:37:inblock in visit'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:47:in visit_root' sass (3.1.14) lib/sass/tree/visitors/base.rb:37:invisit'
sass (3.1.14) lib/sass/tree/visitors/perform.rb:18:in visit' sass (3.1.14) lib/sass/tree/visitors/perform.rb:7:invisit'
sass (3.1.14) lib/sass/tree/root_node.rb:20:in render' sass (3.1.14) lib/sass/engine.rb:299:in_render'
sass (3.1.14) lib/sass/engine.rb:246:in render' sass-rails (3.2.4) lib/sass/rails/template_handlers.rb:106:inevaluate'

Using

bootstrap-sass (2.0.0)

Use Sass’s @import directive?

From SASS's website:
@import
Stylesheets can get pretty big. CSS has an @import directive that allows you to break your styles up into multiple stylesheets, but each stylesheet takes a separate (slow) HTTP request. That’s why Sass’s @import directive pulls in the stylesheets directly. Not only that, but any variables or mixins defined in @imported files are available to the files that import them.

Sass has a naming convention for files that are meant to be imported (called “partials”): they begin with an underscore. Let’s create a partial called _rounded.scss to hold our rounded mixin.

In order to support both .scss and .sass files, Sass allows files to be imported without specifying a file extension. That means we can just import "rounded", rather than "rounded.scss".

I checked the gem, and it looks like it does not use the underscore convention to import the files. Do you have a trick behind this or do you use the normal css slow import like they mention? If it's the case, maybe converting the imports using the sass convention would be good?

Thanks

couldn't find file 'bootstrap' after bundle install.

I added gem 'bootstrap-sass', '1.4.0' to my Gemfile and did a bundle install. It picked up the gem and installed it.

I added *= require bootstrap to my application.css....

When I hit my page I see:

couldn't find file 'bootstrap'
(in /home/jim/Sites/isr-update/app/assets/stylesheets/application.css:6)

I don't see the files in lib or vendor, should they be there?

@import 'bootstrap' error on win7

When i use this directive i get the error below
different prefix: "D:/" and "F:/xxx/app/assets/stylesheets"
(in F:/xxx/app/assets/stylesheets/style.css.scss)

seems @import can't load the scss file in different path on windows?

merging?

So I was working on something just like this for Bootstrap 2 and then found yours :) I've got a repository here (I've mostly focused on 2.0) setup which works both with and without rails (so you could use it with compass in non-rails projects).

Would you be interested in just merging them for bootstrap 2 development? Having 100 forks of bootstrap for sass just seems silly since it would be better maintained together.

I was planning on possibly extracting out some of the patterns a little better (so you could load bootstrap/patterns for all, or bootstrap/patterns/pattern for specific ones) as well as possibly setup a few additional variables so its easier to configure (instead of just changing blue/black etc since maybe you don't want blue or black buttons :) ). I also sub-moduled twitter's repository to track their updates easier with a quick rake task that updates the submodule and copies over the javascripts etc.

If you'd like to do so just let me know and I can take a sec and fork your 2.0 branch and marge in some updates.

nav lists misses parts of the official less stylesheet

I'm building an nav-list and the .active:hover state is currently broken. Some investigation pointed out that the original less stylesheet has more / newer styling then the current .scss file has.

navs.less:49-61

.nav-list > li + .nav-header {
  margin-top: 9px;
}
.nav-list .active > a,
.nav-list .active > a:hover {
  color: @white;
  text-shadow: 0 -1px 0 rgba(0,0,0,.2);
  background-color: @linkColor;
}
.nav-list [class^="icon-"] {
  margin-right: 2px;
}

navs.scss:48-58

.nav-list > li + .nav-header {
  margin-top: 9px;
}
.nav-list .active > a {
  color: $white;
  text-shadow: 0 -1px 0 rgba(0,0,0,.2);
  background-color: $linkColor;
}
.nav-list .icon {
  margin-right: 2px;
}

2.0 official release?

I know 2.0 has been converted in the 2.0 branch (I'm using it and it's good btw) but will it get an official tag and release?

import not found when @import bootstrap in application.css.scss

firstly, i changed the application.css to .css.scss
then add @import "bootstrap"; line.

but the page show an error:

File to import not found or unreadable: bootstrap.

but i works when i change the import line to another .scss file and require it in application.css.scss.

and another question is the file which import bootstrap can't end with .css.scss but only .scss. i don't know what's the different between the two type files?

Versioning Suggestion

From Readme:

We try to stick to Bootstrap versioning wherever possible. The major and minor version numbers will always represent the Twitter Bootstrap version, but no guarantees are made for the tiny version number, since waiting for Bootstrap to update so I can push out a fix sucks.

Why not go to a 4 part version, allowing you to use the 4th part independently of the bootstrap version. It'd be confusing to get into a situation where bootstrap uses the tiny version number and it doesn't match the bootstrap-sass version.

Undefined variable: "$baseline"

Bootstrap-sass is being pulled in by RailsAdmin, I'm using Rails 3.1.3 and RailsAdmin master, running the rake assets:precompile task produces the following error:

stylesheets: rake assets:precompile
(in /Users/billlazar/Sites/j3)
/Users/billlazar/.rvm/rubies/ruby-1.9.2-p180-patched/bin/ruby /Users/billlazar/.rvm/gems/[email protected]/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
rake aborted!
Undefined variable: "$baseline".
  (in /Users/billlazar/.rvm/gems/[email protected]/gems/bootstrap-sass-1.4.3/vendor/assets/stylesheets/bootstrap/forms.css.scss)

Bootstrap uses classes instead of mixins

Whilst bootstrap is great, it uses classes instead of mixins, forcing loads of styling classes into our markup.

I'd like to maintain a version of bootstrap that converts all of these classes into mixins. However, this will have two disadvantages:

  • Harder to maintain gem as changes to twitter bootstrap will need to be manually converted over
  • Not backwards compatible as anyone using the gem will have to switch their class markup over to including the mixins

I'd like to fork this project to base these alterations on but the question is whether to push them back into this gem or release them in an entirely new one. What do you think?

Prefixes .btn- for buttons and others (couldn't re-open previous)

https://github.com/twitter/bootstrap/blob/master/less/buttons.less

look for .btn-large, .btn-primary, etc.

current bootstrap-sass 2.0 branch only use .primary, .large, etc. Same for many other Bootstrap elements (tables, nav, etc.). These prefixes commits were done yesterday so that's possible you didnt see them yet, here is one: twbs/bootstrap@3191165

Sorry for re-opening an issue, I don't know if you get notified when I comment on a closed issue, so I didn't take any chances.

I'm currently at work, I could probably do this tonight if you don't have time...

Why rename css selectors?

Thanks for porting the bootstrap less code to sass, Thomas.

I had some initial trouble getting setup and finding the right css classes to use. I was reading the Bootstrap docs and assuming the same classes applied to bootstrap-sass.

For example in Bootstrap the correct way to use a primary large button is:

<button class="btn btn-primary btn-large">

But in bootstrap-sass I need to do:

<button class="btn primary large">

Even though the bootstrap-sass way is slightly cleaner, that's beside the point, am I doing something wrong or have you changed the selectors, or is this some magical less thing I'm not understanding.

Is this a design choice to change the selector names?

How to config variables

Twitter bootstrap has a file named preboot.less to set variable like gridColumns, but how can I do the same thing with bootstrap-sass. It seems that the imported file included in the file bootstrap.scss doesn't include preboot.scss.

compass install bootstrap does not support easy customization

Issue

The way the original twitter bootstrap distribution is organized, it's expected one can customize various aspects of it. In this case, the files would normally be copied into a project and could be readily edited if necessary. However, with the packaging of the SCSS files in a gem, they are not available for modification.

Modification of Variables

The settings in bootstrap/_variables.scss are expected to be modified. An easy way to expose the variables would be to use the compass templating to copy the contents of _variables.scss into the generated styles.scss before the @import "bootstrap" while possibly removing the !default notation. Any change to a variable made by a user would override the same variable in _variables.scss when imported.

Modification to Imported Mixin's

For applications that won't use various bootstrap mixin's it would be ideal if _bootstrap.scss was locally editable so such mixin's could be commented out.

Do I need to include jquery-rails in my gemfile?

Hey,

I am trying to use jquery plugins from bootstrap ... without success.

Do I need to add jquery-rails to my gemfile?

Also how can I verify that my bootstrap-sass is correctly installed?

Sorry for the newbie questions...

And by the way, is this the right place to post questions about this gem?

Joel

Issue loading on heroku (Failed to import)

Hello,

it works find locally in development but when I deploy to heroku I get the following error.

File to import not found or unreadable: bootstrap.
Load path: /app
(in /app/app/assets/stylesheets/main.css.scss)

The code I have is this

@import "bootstrap";

Thanks, Ross

CSS causing tabs breakage

Not sure exactly what change it is, but the version of the CSS included in this version of the gem is causing inactive tab content to be shown instead of hidden.

css rendering problem on IE8-9

Step to reproduce:

Diffing the CSS output manually, I found out:

less:
progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0)

sass:
progid:DXImageTransform.Microsoft.gradient(startColorstr=#333, endColorstr=#222, GradientType=0)

Probably what's causing it.

bootstrap-sass not include in assetpath

When creating a new Project the integration of the bootstrap-sass gem works fine.

But now I wanted to integrate it in an existing project. But there the gem is not include into the assetpath. I checked with:

Rails.application.config.assets.paths The gem paths are not included.

Any ideas what went wrong?

On the Server I get the error:

couldn't find file 'bootstrap-dropdown' or every other file I try

Opacity mixin conflict with compass

Using v2.0 I noticed the modal overlay blacks out the screen because opacity is set to 80, not 0.8;

Compass defines the opacity mixin to take a value between 0 and 1.
Twitter bootstrap's LESS opacity mixin takes a value from 0 to 100.

I'm adding a few bootstrap components to an existing compass styled site using Rails 3.2 with asset pipeline. I worked around this conflict by having two separate top level stylesheets, having a bootstrap only one that does not include compass.

I guess this is a good use case for namespacing?

2.0 Breaks compilation: Expected a color. Got: transparent

I'm not sure if this is a sass compilation error or a bug in the twitter bootstrap.css for version 2.0. I received this error after applying a hack as shown in this issue:

#40

I'm posting it here in case its related to the above issue. Below is the output from my terminal:

1.9.2-p290 > rake assets:precompile
/Users/manish/.rbenv/versions/1.9.2-p290/bin/ruby /Users/manish/.rbenv/versions/1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Expected a color. Got: transparent
(in /Users/manish/projects/trouper/vendor/assets/stylesheets/bootstrap.css)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/manish/.rbenv/versions/1.9.2-p290/b...]

Tasks: TOP => assets:precompile

Running compass unpack bootstrap fails

Running compass unpack bootstrap should unpack all files into ./extensions/bootstrap under the compass project root.

Steps to Reproduce

  1. gem install bootstrap-sass
  2. Add: require 'bootstrap-sass' to top of config.rb
  3. mkdir extensions
  4. Run compass frameworks to ensure bootstrap is listed
  5. Attempt to unpack: compass unpack bootstrap

Expected Result

All bootstrap files extracted into ./extensions/bootstrap.

Actual Result

$ compass unpack bootstrap --trace

NoMethodError on line ["47"] of c: undefined method 'size' for nil:NilClass
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/commands/unpack_extension.rb:45:in 'each'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/commands/unpack_extension.rb:45:in 'perform'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/commands/base.rb:18:in 'execute'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/commands/project_base.rb:19:in 'execute'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/bin/compass:25:in 'block in <top (required)>'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/bin/compass:39:in 'call'
  c:/Ruby192/lib/ruby/gems/1.9.1/gems/compass-0.11.7/bin/compass:39:in '<top (required)>'
  c:/Ruby192/bin/compass:19:in 'load'
  c:/Ruby192/bin/compass:19:in '<main>'

Environment

  • Msys Git on Windows 7
  • ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
  • sass 3.1.15
  • compass 0.11.7

Didn't install files in asset-pipeline folder

Hey,

I assumed that I just needed to include the gem in my Gemfile and run Bundle update.

Am I missing something?

The bootstrap-sass file are not in my assets folder ...

Hope you can help,

Joel

Rails Helper Suite

It would be nice if bootstrap-sass had a series of Rails helpers that would make common tasks with bootstrap easier.

On the provisional list are:

  • Form helpers (no 1 priority really, cause bootstrap forms are a pain to markup)
  • Headings
  • Common structural blocks

bootstrap file is missing after upgrading

I have updated the current gem:

bundle update

Now it's version 2.0.0. Also, I have restarted my server.

Now I'm getting:

 couldn't find file 'bootstrap'
  (in /projects/testing/app/assets/stylesheets/application_en.css:5)

I do have the needed require statement in my manifest file, which is used to work for me:

/*
 *= require bootstrap
*/

Not sure what's missing here. Any help?

Bootstrap v2.0

Hi, I know it just came out. I'd just like to know whether you will be making a sass version of bootstrap 2.0, so I know whether to move my rails project to less or not.

Thanks for doing this.

responsive problems

Thanks for the update to 2.0! I have a strange issue: after I updated to 2.0, responsive was working fine for about 20 minutes, then very suddenly I got an ugly sass import error:

File to import not found or unreadable: bootstrap/responsive.
Load path: Sass::Rails::Importer(/Users/ian/work/homestars-www/app/assets/stylesheets/application.css.scss)
(in /Users/ian/work/homestars-www/app/assets/stylesheets/application.css.scss)

Has this happened to anyone else?

The only thing I can think of that might be a problem is I installed the new beta of live reload, but I've since turned it off and I'm still getting the import error.

Any help on this issue would be appreciated muchly

3 minutes to precompile

Hi,

Precompiling assets takes ~3mins when I import bootstrap.

I have no idea why. Maybe somebody can shade some light.

This is my layout:

> tree app/assets/
app/assets/
├── images
│   └── icons
│       ├── apple-touch-icon.png
│       └── favicon.ico
├── javascripts
│   ├── application.js
│   └── frameworks.js.coffee
└── stylesheets
    ├── application.css
    ├── frameworks.css.sass
    └── layout.css.sass

> cat app/assets/stylesheets/application.css app/assets/stylesheets/frameworks.css.sass 
/*
 *= require_self
 *= require_tree . 
*/


@import "bootstrap"
@import "bootstrap-responsive"

> cat app/assets/javascripts/application.js app/assets/javascripts/frameworks.js.coffee 
//= require jquery
//= require jquery_ujs
//= require_tree .
jQuery(function(){ $("body").addClass('dom-loaded'); });


#= require bootstrap
# Gemfile
group :assets do
  gem 'sass-rails', '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'bootstrap-sass', '~> 2.0'
  gem 'compass', " >= 0.12.alpha.0"
  gem 'uglifier', '>= 1.0.3'
  gem 'therubyracer' # To compile CoffeeScript
  gem 'jquery-rails'
end

So there's really not much going on. Pretty standard stuff.
When I remove the @import bootstrap from sass file then the compilation is pretty "snappy" (~15 secs including Rails startup).

Any thought what could be causing this?

Cheers.

Grid Systems Hard Coded to 12 in Bootstrap Responsive

First off, thanks for updating to bootstrap 2.0! Now, I've noticed in the _bootstrap-responsive.scss vendor file, you hard coded the number of grid columns to 12 for the @media (min-width: 768px) and (max-width: 980px) and @media (min-width: 1200px) sections.

Any way you can allow the sass variable of $gridColumns to be used for those two media queries? I'm trying to squeeze a 4 column side bar next to my 9 column content area and right now it only works at the one resolution in responsive mode...

alerts not working?

Maybe this is just something I've messed up, so just wondering if anyone else isn't seeing alert div's appear since upgrading to 1.4.1 or 1.4.2 ? I rolled back to 1.4.0 and they appear again..

responsive - is it either or?

Can't seem to @import boostrap and bootstrap-responsive in my bootstraploader.css.scss file.

Have tried bootstrap first and responsive first. just get error

Invalid CSS after "": expected selector or at-rule, was "<!DOCTYPE html>"
(in c:/black blah blah /bootstraploader.css.scss)

File looks like this

@import 'bootstrap-responsive';
@import 'bootstrap';

body {
  padding-top: 10px;
}

Is it a case of either having responsive or bootstrap which is not clear or am I missing something obvious?

asset:precompile fails with 2.0.0

The css and js files are properly rendered through the web server using @import "bootstrap"; in application.css, but when I try to run a rake assets:precompile I get the following error:

rake aborted!
File to import not found or unreadable: bootstrap.
Load path: /path/to/myapp
  (in /path/to/myapp/app/assets/stylesheets/application.css)

I'm using rails 3.1.3 and sass-rails 3.1.0

Am I missing something in my config?

sass extensions not working with rake assets:precompile

Hey there,

Having an issue where the sass extension ie_hex_str is not working when generating stylesheets via the rake assets:precompile task. The extension works in the development environment.

Here's the gradient generated for the navbar class in my production environment:

progid:DXImageTransform.Microsoft.gradient(startColorstr='ie-hex-str(#333)', endColorstr='ie-hex-str(#222)', GradientType=0)

whereas here is the same CSS line from my development environment:

progid:DXImageTransform.Microsoft.gradient(startColorstr='#F3333', endColorstr='#F2222', GradientType=0)

I noted that raising an error on the first line of the ie_hex_str method causes my development server to throw an exception when a page is loaded, but running the rake assets:precompile task completes successfully.

Any advice?

README.md update to avoid "An @import loop has been found"

The README said to "import 'bootstrap' in your SCSS file of choice, so I created bootstrap.css.scss and added the @import statement. I kept getting the Action Controller error "An @import loop has been found: ../app/assets/stylesheets/bootstrap.css.scss imports itself". Finally realized that it was importing the local file by name rather than going to the gem directory. Renamed my file to bootstrap_loader.css.scss and all is well.

May I suggest:

Import "bootstrap" in any SCSS file in your /app/assets/stylesheets directory to get all of Bootstrap's styles, mixins and variables! Don't use Sprocket's //= require directives for SASS files, because they're horrible and will kill your cat. You can add the @import statement to a new file, e,g. bootstrap_loader.css.scss. Don't import bootstrap in application.css; that's not an SCSS file. And don't use a file named bootstrap.css.scss or it will try to import itself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.