Sass does not rewrite files with prefix

Asked

Viewed 202 times

1

I have copied some . scss files to my project, these files are prefixed with _ in the name (e.g. _style, _mediaqueries, etc.). Compass rewrites all files normally, except those with prefixes. Some people told me it shouldn’t interfere with Sass’s behavior.

Can anyone tell me if the problem is in some configuration, or if it really doesn’t read files with prefixes like this?

  • I suppose your problem is the same as mine. I have snippets of code being imported into mine. Main scss and these snippets of code are not rewritten when changed. When I used Ruby everything worked normal, I switched to Node-Sass and started this error. I don’t know why, but I took the prefixes of my snippets and it worked again.

2 answers

0

Like the SASS interprets files with '_' as partial, just rename the file to a "common" name that will all be compiled accordingly.

But attention: usually Frameworks and libraries make use of partials precisely so that these files are not compiled.

The correct way to use partial is to import them into the file SASS which will be compiled. The compiler will write to CSS only the classes/functions that were actually used of that partial, and not the whole file.

0

SASS interprets the files started with underline as partial. It is quite simple logic because much of the style sheets written in SASS is made up of several partial files and a "compiled" version of them.

The font-awesome, for example, uses that structure:

inserir a descrição da imagem aqui

Where only the font-awesome.scss file is compiled in CSS and the others are partial that composes it.

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.