Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import path for external sass repositories? #8

Open
pcj opened this issue Feb 15, 2017 · 4 comments
Open

Import path for external sass repositories? #8

pcj opened this issue Feb 15, 2017 · 4 comments

Comments

@pcj
Copy link
Member

pcj commented Feb 15, 2017

Given an external repository definition like so, I'm struggling to figure out what the correct @import path would be for the external sass_library. For example:

# WORKSPACE
MILLIGRAM_BUILD_FILE = """
load("@io_bazel_rules_sass//sass:sass.bzl",
     "sass_binary",
     "sass_library",
)

sass_library(
    name = "milligram",
    srcs = glob(["_*.sass"]),
    visibility = ["//visibility:public"],
)
"""

new_http_archive(
    name = "com_github_milligram_milligram",
    url = "https://github.com/milligram/milligram/archive/v1.3.0.tar.gz",
    strip_prefix = "milligram-1.3.0/src",
    build_file_content = MILLIGRAM_BUILD_FILE,
)
# example/BUILD
sass_binary(
    name = "style",
    src = "style.sass",
    deps = [
        "@com_github_milligram_milligram//:milligram",
    ],
)
// example/style.sass
@import "com_github_milligram_milligram/milligram";
//      ^ What is the correct import here?
@pcj
Copy link
Member Author

pcj commented Feb 15, 2017

Figured it out: need to prefix with external/, such as:

@import "external/com_github_milligram_milligram/milligram";

Will leave this open and close it with a PR to the README.

@sgammon
Copy link

sgammon commented Jun 21, 2019

@pcj this worked for us too, but it also broke build sandboxing for us.

@thosakwe
Copy link

Just adding that you can see the contents of the external/ dir using bazel info execution_root. I didn't know the exact path to import until I looked there:

cd `bazel info execution_root`
ls external

@motiejus
Copy link

Thanks for the pointers. This works for the resulting files, but the map file displays a directory that the clients don't like as much:

"sources":["../../../../../../../external/pure.css/file/pure.css","../../../../../../../external/grids-responsive.css/file/grids-responsive.css","../../../../../../../src/hthing/web/static/styles.scss"]

In my case, ideally this should only be

"sources":["pure.css","grids-responsive.css","styles.scss"]

Any pointers how to generate a "resolved" source map?

gonzojive pushed a commit to gonzojive/rules_sass that referenced this issue Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants