0

Project structure looks something along the lines of:

.
├── UI
│   ├── BUILD
│   └── app.js
└── component
    ├── BUILD
    ├── component.soy
    ├── component.js
    └── component.gss

The app's BUILD file looks like:

closure_js_library(
    name = "app",
    srcs = ["app.js"],
    deps = [
        "//src/main/java/.../component",
    ],
)

closure_js_binary(
    name = "ui",
    entry_points = ["...app"],
    deps = [":app"],
    css = "//src/main/java/.../component:component_css_bin",
)

The component's BUILD file looks like the following:

closure_css_library(
    name = "component_css",
    srcs = ["component.css"],
)

closure_css_binary(
    name = "component_css_bin",
    renaming = True,
    deps = [":component_css"],
)

closure_js_template_library(
    name = "component_soy",
    srcs = ["component.soy"],
    deps = [
        ":component_css",
    ],
)

closure_js_library(
    name = "component",
    srcs = [
        "component.js",
    ],
    deps = [
        ":component_soy",
    ],
)

The css file:

.a_class {
  background-color: blue;
}

The soy file:

{namespace component.templates
    requirecsspath="./component"}

{template .fileInfo}
    <div class="{css('a_class')}"></div>
{/template}

Where the .js files only render the soy file.

Then when launching with bazel run .../ui:ui_dev_server the appropriate css mapping appears but there no corresponding css file. Even though the css appears in the build output.

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
Gunslinger
  • 1,456
  • 7
  • 22
  • 36

0 Answers0