Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

How to shim things. #40

Closed
trusktr opened this issue Oct 8, 2014 · 4 comments
Closed

How to shim things. #40

trusktr opened this issue Oct 8, 2014 · 4 comments

Comments

@trusktr
Copy link
Contributor

trusktr commented Oct 8, 2014

I'm not entirely clear on how shimming works. We should expand the wiki on this.

@guybedford Could you explain what exactly is going on in the shim of this bootstrap example?

{
  "registry": "jspm",
  "dependencies": {
    "jquery": "*",
    "css": "*"
  },
  "shim": {
    "js/bootstrap": {
      "deps": ["jquery", "../css/bootstrap.css!"],
      "exports": "$"
    }
  }
}
@guybedford
Copy link
Member

In this example, the file "js/bootstrap.js" in the bootstrap package is being made to be dependent on jquery and the css file. It is as if we wrote the following at the top of the file:

import 'jquery';
import '../css/bootstrap.css!';
... rest of bootstrap ...

Of course in a way that can work with any module format.

@trusktr
Copy link
Contributor Author

trusktr commented Oct 9, 2014

@guybedford Sweeet, thanks. So based on that bootstrap override, is it the dependencies: property that causes my config.js to contain something like the following?

System.config({
  "map": {
    "bootstrap": "github:twbs/bootstrap@^3.2.0",
    "github:twbs/[email protected]": {
      "css": "github:systemjs/plugin-css@^0.1.0",
      "jquery": "github:components/jquery@^2.1.1"
    }
});

I'm wondering because in jspm/jspm-cli#173 I don't see the dependencies of my command line override appearing anywhere. Should they appear in my config.js file? All I see in config.js is this:

    "jquery-tooltipster": "github:iamceege/tooltipster@^3.2.6"

Should I instead see something like

    "jquery-tooltipster": "github:iamceege/tooltipster@^3.2.6"
    "github:iamceege/tooltipster@^3.2.6": {
      "jquery": "github:components/jquery@^2.1.1"
    }

?

@trusktr
Copy link
Contributor Author

trusktr commented Oct 9, 2014

As I discovered in jspm/jspm-cli#175, I was missing the registry property in my override. After including registry: "jspm" then config.js contains the proper dependencies.

@trusktr trusktr closed this as completed Oct 9, 2014
@guybedford
Copy link
Member

Great, they are also stored in the package.json by default as you install.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants