-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.bzl
55 lines (50 loc) · 1.5 KB
/
index.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library")
def ng_module(
# name used for this rule
name,
# typescript sources
srcs,
# dependencies for the typescript files
deps = [],
# scss files used by the component
style = None,
# any dependencies needed for the scss style
style_deps = [],
# assets, eg html files etc
assets = [],
# theme file if required
theme = None,
# dependencies for the theme
theme_deps = [],
# the visibility of the ng_module
visibility = ["//:__subpackages__"],
**kwargs):
if theme != None:
_sass_binary(
name = "%s_theme" % name,
src = theme,
deps = theme_deps,
visibility = ["//:__subpackages__"],
)
ng_module_assets = assets
if style != None:
_sass_binary(
name = "%s_styles" % name,
src = style,
deps = style_deps,
visibility = visibility,
)
ng_module_assets = ng_module_assets + [":%s_styles" % name]
_ng_module(
name = name,
srcs = srcs,
assets = ng_module_assets,
visibility = visibility,
deps = [
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//rxjs",
] + deps,
**kwargs
)