V
V
Vadim2017-01-06 20:44:04
npm
Vadim, 2017-01-06 20:44:04

Does it make sense to use bower if all frontend packages are in npm?

I was taught so that first I install bower and gulp via npm and then through bower everything that is needed for the frontend (css, js).
And now I look, and npm has everything that I put through bower.
Do I breed entities or divide and conquer? :) Should I give up the bower?
Maybe something else to use?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ihor Gevorkyan, 2017-01-06
@kylt_lichnosti

Everything is relative, within the framework of the task, these are tools, you are free to use them at your convenience.
For example, I very often use yeoman generators to start a project, and if they are based on gulp, then bower is most likely used there, in such cases you won’t get out on one npm, because the configurations and code are clearly separated there, bower_components are already in the resources, of course, through the .bowerrc directory, you can place it anywhere, but you will have to rewrite, in the case of some kind of yeoman generator, the gulpfile as well. bower itself recommends using only npm for both dev dependencies and library dependencies. NPM is a very cool thing, but one thing I miss in it that bower has is wiredep. I don't like manually writing dependencies, but wiredep does it automatically. Therefore, for myself, I chose what is convenient for me, when npm is responsible for everything related to the assembly, and bower is responsible for everything related to libraries. Now, for example,
By the way, if anyone has learned about some kind of automation for writing dependencies via npm, please share your knowledge.
And I think that npm, like bower, will soon write that they recommend working only with yarn, we'll see how it goes.

D
Dmitry Luzanov, 2017-06-19
@dmitry_luzanov

[flight: true, passengers: true, customer: true, history: true]

It's not an array. It's not even an object. Speaking of js.
{flight: true, passengers: true, customer: true, history: true} - this is the object.
You can loop through it like this:
const obj = {flight: true, passengers: true, customer: true, history: true}

Object.keys(obj).forEach(key => obj[key] = false)

As for angular, it depends on the big picture. And she is not. So there is no complete answer. Give a complete picture and the answer will be supplemented.

F
Fedwar, 2017-06-19
@Fedwar

As I understand it, you forgot the brackets, because there is 1 object, as I understand it?

for (var key in arr[0])  {
arr[0][key] = false;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question