Skip to content

The @import rule does not properly import the requested file #402

@steve-todorov

Description

@steve-todorov

The @import rule in SASS can be used in two ways:

  1. As a css import rule resolving in @import: url(url) when compiled.
  2. As a rule which actually imports/includes another sass or css file inside the currently compiled on.This particularly useful when your assets are managed by bower and you want to compile and minify everything into a single css file.

Here is a link explaining what I'm talking about. Some important links from there:

  1. The logic behind how the @import rule works.
  2. The PR when this was implemented.

In the current version of scssphp the @import rule will result in the following compiled css:

@import '../other/subdir/import_me'

instead of actually importing the content of the import_me file.

After digging through the source code of scssphp I found out the solution is quite simple. One should only append $url.'.css' to the Compiler.php#L3218. Afterwards everything should work as expected in both scenarios when using @import.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions