Update SASS in ruby - css

I am working on a project based on ruby. How can I update the SASS engine? My PC has one version, but my project doesn't.
I've tried using gem update, but it doesn't update SASS.
Any help?

If you are using bundler, you can just run
bundle update sass
Without bundler rubygems can install fresh version, but your app may use old one. Try to uninstall older version.
But the best solution to escape such problems - is to use bundler.

Related

Bootstrap is wrong version in my rails project

I am going through a rails Udemy course, and we are using bootstrap. The instructor is on an older version and I started using the most recent version. Before long I discovered they are very different, so I wanted to switch to the correct version for the project. I have done gem uninstall gem bootstrap, and rails assets:clean, and went as far as to switch back to main and delete that git branch. I then updated the gemfile to install bootstrap 4.0.0, and ran bundle install. Gemfile lock reflects the changes. I then copied the instructors provided source files for the views we had been working on and the application.scss file. It has not worked. The scss in the rails app is being completely overridden by some trace of bootstrap 5.2. I know this because I inspected the page in the chrome dev console and in the sources there is this link which references the version.
/* line 1, ../../.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootstrap-5.2.0/assets/stylesheets/bootstrap/_root.scss */
I have restarted the rails server multiple times, but there is no effect. I have navigated to that folder in the rbenv directory and the bootstrap-4.0.0.alpha6 version is listed there, not the 5.2.0. However, the 5.2.0 version is persisting in what is on the browser. No changes that I make in the scss file have any effect. I tried changing all the colors to random ones, but none show up. There are no error messages to share. The CSS simply has no effect and appears to be overridden by this file that I cannot find anywhere in my rails project or on my system. Thank your for any guidance to fix this.
I found an answer.. I had to use rake assets:clobber to clear out precompiled files that had the bootstrap 5.2.0 in them. I did that and then rake assets:precompile and it instantly fixed it.

What is the proper way to upgrade Bootstrap 4 for Rails?

I tried to upgrade from Bootstrap 4 Alpha 6 to 4.0.0 final version for my Rails 5 project, I'm sure the v4.0.0 gem has been installed (I also uninstalled the alpha version gem), but when I run my project (dev mode), I found the generated Bootstrap CSS files are still based on the Alpha version.
gem 'bootstrap', '~> 4.0.0'
Other than uninstalling the old gem and install the new bootstrap gem, do I need to do anything else for the upgrade? Download the physical v4.0.0 files and replace the old files in my project?
You can have look at this article:
How to update a single gem conservatively
Option 1
This will work if all dependencies for the update are already satisfied.
Find out the version you want to update to
Change it directly in Gemfile.lock
Run bundle install and see if that worked
Option 2
This will work if the gem has no shared dependencies with other gems.
Find out the version you want to update to.
Add that version explicitly to the Gemfile with , '=1.2.3'
Run bundle install
Remove the explicit version number again
Run bundle install once more
Option 3
This should always work.
Run bundle update GEMNAME
Run git diff Gemfile.lock and notice all the updates you didn't want
Revert the unwanted changes to Gemfile.lock you don't want (manually or by staging changed lines one-by-one), leaving only the desired updates.
Run bundle install and see if that worked
Option 4
There are persistent rumors that you can update a single gem by calling bundle update --source GEMNAME. However no one seems to know how and why this works, it's not a documented feature of Bundler. It might be an unintended side effect of something else.
I believe this command will try to update GEMNAME and GEMNAME only. If this leads to unmatched dependencies to other locked gems, it will fail.
If you use this option, be sure to git diff your Gemfile.lock to see if the changes are what you expected.
Option 5
Bundler >= 1.14 has a --conservative flag. Using the conservative flag allows bundle update GEM to update the version of GEM, but prevents Bundler from updating the versions of any of the gems that GEM depends on.
Credits To Author: Henning Koch
Try to keep Ruby dependencies in your Gemfile and JS/CSS ones elsewhere. Node+Yarn is a good way to do that.
If not already there
brew install yarn
Then in config/initializers/assets.rb
Rails.application.config.assets.paths << Rails.root.join('node_modules')
Now you can do this in your console:
yarn add bootstrap
It should have create a node-modules directory if not already there.
Then just add bootstrap to your JS/SCSS files
JS
//= require bootstrap/js/src/index
CSS
#import "bootstrap/scss/bootstrap";

compass cannot compile completely using compass v0.12.6+sass v3.3.1? [duplicate]

I have just upgraded to Sass 3.3 so that I can use some of the new features (BEM styled class names, mappings, #at-root, etc). If I compile my project with Sass (via sass --watch), it works just fine. However, if I compile it using Compass (via compass watch), I get an error when using the new Sass features.
I'm using Compass 0.12.
Compass 0.12 explicitly depends on Sass 3.2. Even if you have a newer version of Sass installed, it will still compile with 3.2. In order to use Sass 3.3 or later, you have to be using Compass 1.0 or later.
Running the gem install command normally should get you the latest stable version.
gem install compass
At the time this question was asked, Compass 1.0 was still in beta. To install the latest beta version of a gem, you will need to install it using the --pre flag.
gem install compass --pre
Note that you do not need to install Sass first in order for this to work. Installing Compass will automatically install the latest version of Sass that it is compatible with.
I have Compass 1.0 installed and it still errors
Double check any other dependencies you might have (Compass extensions, etc.), one of them might be specifying an older version of Sass or Compass.
If you're using an application or build tool rather than using the commands directly, make sure they're not referencing older versions of Compass.
Windows users
As a Window user, I got an error when I tried to watch my project using the newer Compass.
LoadError on line ["36"] of C: cannot load such file -- wdm"
To fix that problem:
You must install the ruby DevKit:
Download found here: http://rubyinstaller.org/downloads/
Follow this page to properly install:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Now install wdm:
gem install wdm
There didn't seem to be any one place that contained the whole list of steps required, in order, to make this work, so here they are. This list is for Windows, but it may work fine on other platforms.
Install Ruby -- use 1.9.3 -- http://rubyinstaller.org/downloads .
Download the Ruby DevKit found lower on the same page -- http://rubyinstaller.org/downloads/
run it to extract it somewhere (permanent). Then cd to it, run “ruby dk.rb init” and “ruby dk.rb install” to bind it to ruby installations in your path.
gem install wdm
gem install sass
gem install compass --pre
It now is, in the latest version of Compass. Update compass to get the changes and work with Sass 3.3 and higher
Current Sass compatibility can be found here: https://rubygems.org/gems/compass
To upgrade just run
$gem install compass

Can I undo updating Meteor?

I think updating Meteor might have broken my app. It was working, then I ran meteor update, and now it is not working. Can I do something like meteor downgrade?
Meteor 0.6.0 and above ships with a new distribution system. You can now pass the --release argument to any Meteor command and it will run against the requested release. For example, to bundle your app against Meteor 0.6.1, run: meteor bundle --release 0.6.1. Notably, this only works for post-0.6.0 releases.
If you want to pin your app to a specific release, run: meteor update --release <release>. This modifies the .meteor/release file in your app directory. Then simply run Meteor as usual. You'll still get notified when there's a new release available.
UPDATE: As of Meteor 0.6.0, this functionality is available without using Meteorite. See Avital's answer. (for versions > 0.6.0. To use functionality on versions less than 0.6.0 you can still use Meteorite:
If you want to control versions with your apps (so your existing app can still use an older version, or 0.57.1 (with the security bug fix) you can use meteorite: https://github.com/oortcloud/meteorite
Install it via npm install -g meteorite
Its also helpful with loads of other packages from http://atmosphere.meteor.com.
To control the version of your app edit your smart.json to something with:
{
"meteor": {
"tag": "v0.5.7"
}
}
Only the app you've already made will be affected & you can upgrade it when you're ready.
I have tried this and it is very hard. My best advice is to try and copy all the files from an app running the version you want, then paste your app's code in there.
There is no meteor downgrade command from its CLI. The best and easy way if you have version control like GIT, just undo your recent changes by git stash save, and run meteor again.
On Windows, I was able to effectively "downgrade" from a failed upgrade by editing the version number to a previous working release in the file:
C:\Users\Paul\AppData\Local.meteor\meteor.bat
You need to change it to a version which has a corresponding folder in: .meteor\packages\meteor-tool

Installing Sass on Gentoo

I've been trying to install Sass on Gentoo, but it hasn't been going too well. Unfortunately, the latest version of Sass in portage is 3.1.21.
What I want to use Sass for requires at least Sass 3.2, which is available through rubygems.
What I've tried:
emerge dev-ruby/sass (installs an old version)
gem install sass
The second command appears to install the Sass gem. However, I do not use Rails or Ruby in any other aspect apart from Sass, so the gem appears useless to me. In addition, I do not know where gems are installed to or how to use them (I'm a ruby noob.) All I want to do is call sass from the command line.
Are there any ways to obtain an up-to-date version of Sass which I can just use from the command line?
Cheers.
On Gentoo, user-installed gems are not in your PATH by default. I have created a bug report because while user-installed gems work much better than they used to, this problem really needs to be rectified. You can help by voicing your opinion in the report and linking back to this page. To get things working, you can either deploy the script I uploaded to the report or use RVM instead, which will give you much more consistent behaviour across distros.
I'm wondering but all the answers looks weird for me. One of the biggest gentoo advantage is ebuild writing which is easy as pie so every user can contribute whatever he needs.
Add local overlay
fork upstream ebuild to your local overlay
bump version
use
test
attach tested ebuild to bug report, maybe also contact someone on #gentoo-dev-help
Trust me, using gem (or cabal, or whatever) instead of your package manager if way to mess your system.
Some might find useful to know that under Gentoo you can install sass using emerge which will solve the PATH problem some people are encountering.
# emerge -av sass
after which you should be able to use sass without problem.
Another solution would be to use rvm which could make things more portable and uniform across environments.
edit: in case someone's asking: to install rvm just follow the instructions found at: https://rvm.io/rvm/install/ and install the stable version.
I don't see a down side to using the gem version of Sass. I'm also not a Ruby/RoR developer (I use Haskell/PHP), and I just use the gem. I know just enough about gems to install/uninstall them, and that seems good enough for using Sass.
Installing and upgrading Sass is done with the same command:
sudo gem install sass
Installing Sass via gems gives you the ability to use it via command line, just like it shows on the official website: http://sass-lang.com/.
sass --watch style.scss:style.css
Other command line options can be found via --help or on their docs: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#using_sass
sass --help
Consider using compass it will accepts command lines like: compass [YOUR-FILE].sass and can also compass watch [SASS FOLDER] and 'compile' css to it.
http://compass-style.org/
To install using a gem
gem update --system
gem install compass
Installation

Resources