irundaia / sbt-sassify

sbt-web plugin for Sass files
Apache License 2.0
68 stars 17 forks source link

Importing an absolute path #41

Closed busti closed 5 years ago

busti commented 5 years ago

Is it possible to import sass files from an absolute path?
At the moment I am using relative paths for imports all over the place. As a project grows this can get quite messy: @import '../../../../colors';

Is there a way to point directly to the root directory in /assets/stylesheets?

irundaia commented 5 years ago

@Busti, you can use the root directory of your assets directly. This depends on the value of sourceDirectory in Assets (from sbt-web). I think that by default this should be src/main/assets.

So suppose you've got a directory structure like:

main
└ assets
  └ stylesheets
    └ deeply
      └ nested
        └ asset
          └ directory
            └ style.scss
    └ import
      └ _import.scss

Then you can import _import.scss by simply using @import 'stylesheets/import/import'. Note that a leading / would mean an import relative to the root of your filesystem.

I'll push the example above in an sbt-test. Then you can check it out.

irundaia commented 5 years ago

I just added the example, you can find it here.

Does that answer your question?

busti commented 5 years ago

That works perfectly.
Thanks a lot for adding the example.