Using subfolders for the Sass batch in the Compass project directory structure

I have a compass project and it works with scss files in the src directory that are compiled to the sttylesheets directory as css. Everything is fine, and I can use the sass @import command without any problems.

However, I would like to bring a little organization into my sass scores and put them in the appropriate folders in the src directory. However, when I try to do this, the @import command fails.

Is there any way to do this?

UPDATE: I found in the compass docs that I can add add_import_path to my configuration file, but I cannot get this to work. I tried the full path to the directory and the path to the project, but nothing happens.

Someone please help, it can't be that hard!

+4
source share
5 answers

So, it turned out that I was wrong. I tried to be effective and organize my folder structure before doing anything with the compass. I realized that I needed to set up the compass in order to see the project first and then create the folder structure. This way, the folder structure is replicated to my stylesheets or CSS folder instead of just being in the original folder. Now everything works as it should!

0
source

If you placed partial files, for example, in the src / partials directory, simply use @import "partials/name" in the sass / scss files to import them.

0
source

I found that in a static webby project where I used compass / sass, I had to explicitly set the base sass path, which would be used to pick up sass import (everything worked, except for import).

So, I did something like this in the compass configuration block: config.sass_dir = File.join ('content', 'css')

I assume this is due to the fact that I use something other than the default sass paths, so when I @import, he looked in it for the default path instead of the actual path.

Hope this helps.

0
source

I had the same problem. In fact, I was transferred from the rails + sprockets project to standalone.

I don’t know why, but Compass does not work with asterisk-style names like screen.css.scss . I renamed all my files only to screen.scss , and all partial work worked as expected.

0
source

I had a similar problem. It was very stupid from me, but then again, most of the problems are in programming. My problem was that although I had everything correctly configured for standalone, according to:

https://github.com/twbs/bootstrap-sass

I used a subfolder structure like this:

 project -- stylesheets -- bootstrap -- sass ---- main.scss ------- subfolder1 ----------- partial.scss ------- subfolder2 ----------- partial2.scss 

And in my main.scss I used @import correctly, for example:

@import "subfolder1 / partial.scss"

The problem was this: Compass sees partial correctly if file names begin with an underscore!

As soon as I renamed the files to _partial1.scss and _partial2.scss, everything worked without problems.

0
source

Source: https://habr.com/ru/post/1338621/


All Articles