Question

We're using this gem to integrate Bootstrap in our Rails app. I've been looking to cut some css components that we don't need, an example of which is the Glyphicons. I'm just having some trouble understanding this piece of code in the README:

You can also import components explicitly. To start with a full list of modules copy this file from the gem:

# copy and prepend "bootstrap/" to the @import paths:
sed 's/@import "/@import "bootstrap\//' \
 $(bundle show bootstrap-sass)/vendor/assets/stylesheets/bootstrap/bootstrap.scss > \
 app/assets/stylesheets/bootstrap-custom.scss

What exactly should I do here?

Was it helpful?

Solution

The line you refer to is a command you need to run in your command line (which needs to be unix based so use mac, linux or unix). What it does is access a file (bootstrap.scss), and extract specific lines from it. Then, instead of displaying the result on the screen, it writes it to a file (bootstrap-custom.scss), which, after the command runs, will contain a list of all the modules bootstrap uses. You can now delete those you do not want to use.

More info:

sed 's/@import "/@import "bootstrap\//' - this line uses sed, a unix utility that parses and transforms text, to find only the correct lines.

$(bundle show bootstrap-sass) - the $() indicates that the result of the command inside should be pasted into this place in the longer command outside them.

\ - Appears at the end of the 1st & 2nd lines. It means that although I press enter I I am still typing my command, so don't run it yet.

`>' - redirects the output from the screen to a file.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top