0

Should sass be installed as a 'dependency' or as a 'devDependency'?

In the npm page says: " You can also add it to your project using npm install --save-dev sass."

But in the Install Sass page there is no information about this topic.

I have it like this and it works:

  "devDependencies": {
    "@parcel/transformer-sass": "^2.3.2",
    "parcel": "^2.3.2"
  },
  "dependencies": {
    "normalize.css": "^8.0.1",
    "sass": "^1.49.8"
}

But I wonder whether I should better have it as a devDependency.

Rodrigo
  • 41
  • 1
  • 10

1 Answers1

1

I believe that it depends of your necessity and choice.

If you use the command displayed in Sass's documentation, it will install globally on your local machine and will not be added in your dependencies:

npm install -g sass

Although, if you run --save-dev it will be in your dependencies and always that someone clone your project and run npm install, the sass will be obtained (together with all the other dependencies).

Also I believe you can mix these commands and install globally and in your dependencies if you want: npm install -g --save-dev sass.

There are similar questions that can also help you:

What is the difference between --save and --save-dev?

Rodrigo
  • 41
  • 1
  • 10