refactor(stylus): code review comments
diff --git a/e2e/symlinked_node_modules_yarn/WORKSPACE b/e2e/symlinked_node_modules_yarn/WORKSPACE
index 932d83d..b3404f5 100644
--- a/e2e/symlinked_node_modules_yarn/WORKSPACE
+++ b/e2e/symlinked_node_modules_yarn/WORKSPACE
@@ -16,3 +16,12 @@
     quiet = False,
     yarn_lock = "//:yarn.lock",
 )
+
+# Dependencies for generating documentation
+load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
+
+sass_repositories()
+
+load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
+
+skydoc_repositories()
diff --git a/packages/stylus/docs/install.md b/packages/stylus/docs/install.md
index 1c02fb3..e2642de 100644
--- a/packages/stylus/docs/install.md
+++ b/packages/stylus/docs/install.md
@@ -14,3 +14,18 @@
 
 This causes the `@bazel/stylus` package to be installed as a Bazel workspace named `npm_bazel_stylus`.
 
+## Installing with self-managed dependencies
+
+If you didn't use the `yarn_install` or `npm_install` rule to create an `npm` workspace, you'll have to declare a rule in your root `BUILD.bazel` file to execute stylus:
+
+```python
+# Create a stylus rule to use in stylus_binary#compiler
+# attribute when using self-managed dependencies
+nodejs_binary(
+    name = "stylus_bin",
+    entry_point = "//:node_modules/stylus/bin/stylus",
+    # Point bazel to your node_modules to find the entry point
+    node_modules = ["//:node_modules"],
+)
+```
+
diff --git a/packages/stylus/src/index.bzl b/packages/stylus/src/index.bzl
index d1a3846..4ca263b 100644
--- a/packages/stylus/src/index.bzl
+++ b/packages/stylus/src/index.bzl
@@ -12,8 +12,10 @@
     ctx.actions.run(
         outputs = [css_output, map_output],
         inputs = [src] + ctx.files.deps,
-        executable = ctx.executable._compiler,
+        executable = ctx.executable.compiler,
         arguments = [
+            "--resolve-url",
+            "--compress",
             "--sourcemap",
             "--out",
             ctx.bin_dir.path + "/" + ctx.label.package,
@@ -31,13 +33,16 @@
             mandatory = True,
             allow_single_file = True,
         ),
-        "deps": attr.label_list(
-            allow_files = True,
-        ),
-        "_compiler": attr.label(
+        "compiler": attr.label(
+            doc = """Label that points to the stylus binary to run.
+            If you install your npm packages to a workspace named something other than "npm",
+            you may need to set this to `@my_npm_name//stylus/bin:stylus`""",
             default = Label("@npm//stylus/bin:stylus"),
             cfg = "host",
             executable = True,
         ),
+        "deps": attr.label_list(
+            allow_files = True,
+        ),
     },
 )
diff --git a/packages/stylus/test/BUILD.bazel b/packages/stylus/test/BUILD.bazel
index 85ee7c6..91f96d2 100644
--- a/packages/stylus/test/BUILD.bazel
+++ b/packages/stylus/test/BUILD.bazel
@@ -3,7 +3,11 @@
 stylus_binary(
     name = "styles",
     src = "file.styl",
-    deps = ["liba.styl"],
+    deps = [
+        "liba.styl",
+        "subdir/bar.styl",
+        "subdir/baz.png",
+    ],
 )
 
 load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_test")
diff --git a/packages/stylus/test/file.styl b/packages/stylus/test/file.styl
index 5abc35d..204a420 100644
--- a/packages/stylus/test/file.styl
+++ b/packages/stylus/test/file.styl
@@ -1,8 +1,7 @@
 @import "liba"
 
-body {
+body
   font: 14px/1.5 Helvetica, arial, sans-serif;
-  #logo {
-    border-radius: 5px;
-  }
-}
+  #logo
+    border-radius: 5px;  
+  @import "subdir/bar.styl"
diff --git a/packages/stylus/test/stylus_binary_spec.js b/packages/stylus/test/stylus_binary_spec.js
index 92ecca4..a411e71 100644
--- a/packages/stylus/test/stylus_binary_spec.js
+++ b/packages/stylus/test/stylus_binary_spec.js
@@ -5,7 +5,21 @@
   console.error('Expected the css file to be transformed');
   process.exitCode = 1;
 }
-if (content.indexOf('width: 10px') < 0) {
+if (content.indexOf('width:10px') < 0) {
   console.error('Expected the css file to be transformed');
   process.exitCode = 1;
 }
+if (content.match(/\r|\n/)) {
+  console.error('expected compressed but contained newlines', content);
+  process.exitCode = 1;
+}
+// the four ../ segments here are from bazel-out/[arch]/bin/test/ back to the workspace root
+// users will probably have a final packaging where the original png file is layed out
+// next to the css file, so this seems undesirable...
+if (content.indexOf('url("../../../../test/subdir/baz.png")') < 0) {
+  console.error(
+      'expected relative url to be resolved, see ' +
+      'http://stylus-lang.com/docs/executable.html#resolving-relative-urls-inside-imports' +
+      '\n' + content);
+  process.exitCode = 1;
+}
\ No newline at end of file
diff --git a/packages/stylus/test/subdir/bar.styl b/packages/stylus/test/subdir/bar.styl
new file mode 100644
index 0000000..2898d8c
--- /dev/null
+++ b/packages/stylus/test/subdir/bar.styl
@@ -0,0 +1,2 @@
+div#thing
+  background-image: url("baz.png")
diff --git a/packages/stylus/test/subdir/baz.png b/packages/stylus/test/subdir/baz.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/packages/stylus/test/subdir/baz.png
diff --git a/scripts/packages.sh b/scripts/packages.sh
index 3ad2149..ed31368 100644
--- a/scripts/packages.sh
+++ b/scripts/packages.sh
@@ -5,4 +5,4 @@
 # -u: errors if an variable is referenced before being set
 # -o pipefail: causes a pipeline to produce a failure return code if any command errors
 
-export readonly PACKAGES=( create hide-bazel-files jasmine typescript karma protractor labs )
+export readonly PACKAGES=( create hide-bazel-files jasmine typescript karma stylus protractor labs )