           write cssName, cssText
           log "writing optimized#{opts.minify and "/minified" or ""} file to #{cssName}"
 
-        for module in buildProfile().modules
+        profile = buildProfile()
+        for module in profile.modules
           css = {}
+          if isComponent() and /^\.[\/\\]/.test(module.name)
+            module.name = join(config.paths[componentName()], module.name[2..])
           requirejs.optimize
             baseUrl: argv.staticpath
-            paths: config.paths
+            paths: pathsConfig()
+            shim: config.shim
             name: module.name
             optimize: "none"
             keepBuildDir: true


        # returns the on-disk filename for a css dep like 'css!100:foo.css'
        cssFilename = (moduleName) ->
          filename = moduleName.replace /^css!(\d+:)?/, ''
          if filename[-4..] isnt ".css" then filename + ".css" else filename

        # returns the order for a css dep like 'css!100:foo.css'
        cssOrder = (moduleName) ->

      log "installing #{name} to #{tgtDir}"
      wrench.copyDirSyncRecursive src, join(tgtDir, name)

appBuildProfile = (filename = "app.build.js", dir = ".") ->
  eval read(join(dir, filename))

allNodeModules = () ->
  modules = {}
  t.bfs directories = {path: "."}, (n) ->
    if exists join(n.path, "package.json")
      n.json = pkgJson n.path
    if exists join(n.path, "requirejs-config.json")
      n.config = requirejsConfig null, n.path
    if exists join(n.path, "app.build.js")
      n.build = appBuildProfile null, n.path
    modulesDir = join n.path, "node_modules"
    if exists modulesDir
      n.children = _(fs.readdirSync(modulesDir)).map((d) ->
