mpmurph
4 years ago
63
4
Mix

Installing Bootstrap - npm (Node.js)/node_modules vs. Bower/vendor methodology

Posted 4 years ago by mpmurph

Hello all -

I am trying to get Bootstrap (Sass) into my new Laravel 5.1 app and am a bit confused. In the past I have brought in Bootstrap by linking to a CDN but I would like to try to use Sass for the first time and to employ Elixir to compile all of my CSS into one file.

With that goal in mind and, following a variety of instructions, I ended up with a Bootstrap Sass folder in my node_modules directory. I am importing the code into app.scss via the following line of code at the top of the file, processing it with gulp:

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

However, I also installed Bower, created a .bowerrc file in my root (which established a 'bower_components' directory in vendor), ran 'bower init', created a bower.json file in the root and then installed Bootstrap (Sass) into the vendor/bower_components directory... Realizing that I now had Bootstrap in two places, I uninstalled Bower and deleted all the directories/files I had created in the process, including bower_components and that Bootstrap install, falling back to the Node.js install.

As a newbie, I guess I am a bit confused about what is the better method here? After some browsing, it sounds like Node.js is a more stable way of bringing in dependencies whereas Bower is more streamlined one (attempting not to duplicate dependencies).

Any thoughts/insight would be much appreciated! Thank you!

Please sign in or create an account to participate in this conversation.