J
J
jamtuson2020-08-27 10:53:05
Angular
jamtuson, 2020-08-27 10:53:05

How to connect SASS mixins for an angular project?

Hello!
I can't connect globally sass files, such as: file with mixins, variables, grid, and so on. I tried to import them into the global style file, but these variables are not visible in the components.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2020-08-27
@jamtuson

The problem is that SASS component files are separate modules, not related to "global" styles. In order to reuse mixins, variables, etc., create a separate file, for example _utils.scss, where these same mixins and variables would be. And import _utils.scss into those components where they are needed.
A few years ago, I tried to get confused and make mixins enabled by default somewhere in the settings, but I didn’t succeed with a swoop - this is the first time. And two - on reflection, I came to the conclusion that this is not true, because when globalizing mixins, the programmer loses the ability to cleanly and transparently export components to third-party modules. So it goes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question